diff --git a/app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java b/app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java
index 93b240dc7..e1cc0aaef 100644
--- a/app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java
+++ b/app/src/leanback/java/com/fongmi/android/tv/ui/activity/CastActivity.java
@@ -474,7 +474,7 @@ public class CastActivity extends BaseActivity implements CustomKeyDownCast.List
@Override
public void onSpeedUp() {
- if (!mPlayers.isPlaying()) return;
+ if (!mPlayers.isPlaying() || !mPlayers.canAdjustSpeed()) return;
mBinding.control.speed.setText(mPlayers.setSpeed(mPlayers.getSpeed() < 3 ? 3 : 5));
mBinding.widget.speed.startAnimation(ResUtil.getAnim(R.anim.forward));
mBinding.widget.speed.setVisibility(View.VISIBLE);
diff --git a/app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java b/app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
index 03030c87d..2dcc8a59a 100644
--- a/app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
+++ b/app/src/leanback/java/com/fongmi/android/tv/ui/activity/VideoActivity.java
@@ -495,8 +495,10 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
private void setPlayerView() {
getIjk().setPlayer(mPlayers.getPlayer());
mBinding.control.player.setText(mPlayers.getPlayerText());
+ mBinding.control.speed.setEnabled(mPlayers.canAdjustSpeed());
getExo().setVisibility(mPlayers.isExo() ? View.VISIBLE : View.GONE);
getIjk().setVisibility(mPlayers.isIjk() ? View.VISIBLE : View.GONE);
+ mBinding.control.speed.setText(mPlayers.setSpeed(mHistory.getSpeed()));
}
private void setDecodeView() {
@@ -1225,7 +1227,6 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
if (Setting.isIncognito() && mHistory.getKey().equals(getHistoryKey())) mHistory.delete();
mBinding.control.opening.setText(mHistory.getOpening() == 0 ? getString(R.string.play_op) : mPlayers.stringToTime(mHistory.getOpening()));
mBinding.control.ending.setText(mHistory.getEnding() == 0 ? getString(R.string.play_ed) : mPlayers.stringToTime(mHistory.getEnding()));
- mBinding.control.speed.setText(mPlayers.setSpeed(mHistory.getSpeed()));
mPlayers.setPlayer(getPlayer());
setScale(getScale());
setPlayerView();
@@ -1406,6 +1407,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
}
private void onError(ErrorEvent event) {
+ Track.delete(getHistoryKey());
showError(event.getMsg());
mClock.setCallback(null);
mPlayers.stop();
@@ -1672,7 +1674,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List
@Override
public void onSpeedUp() {
- if (!mPlayers.isPlaying()) return;
+ if (!mPlayers.isPlaying() || !mPlayers.canAdjustSpeed()) return;
mBinding.control.speed.setText(mPlayers.setSpeed(mPlayers.getSpeed() < 3 ? 3 : 5));
mBinding.widget.speed.startAnimation(ResUtil.getAnim(R.anim.forward));
mBinding.widget.speed.setVisibility(View.VISIBLE);
diff --git a/app/src/leanback/res/layout/activity_video.xml b/app/src/leanback/res/layout/activity_video.xml
index 0945fda67..c55676834 100644
--- a/app/src/leanback/res/layout/activity_video.xml
+++ b/app/src/leanback/res/layout/activity_video.xml
@@ -42,9 +42,8 @@
0) return;
- if (live.getType() == 0) text(live, getText(live.getUrl(), live.getHeaders()));
- if (live.getType() == 1) json(live, getText(live.getUrl(), live.getHeaders()));
- if (live.getType() == 2) proxy(live, getText(live.getUrl(), live.getHeaders()));
+ if (live.getType() == 0) text(live, getText(live));
+ if (live.getType() == 1) json(live, getText(live));
+ if (live.getType() == 2) proxy(live, getText(live));
}
public static void text(Live live, String text) {
@@ -69,7 +69,6 @@ public class LiveParser {
Setting setting = Setting.create();
Catchup catchup = Catchup.create();
Channel channel = Channel.create("");
- text = text.replace("\r\n", "\n");
for (String line : text.split("\n")) {
if (Thread.interrupted()) break;
if (setting.find(line)) {
@@ -93,10 +92,10 @@ public class LiveParser {
private static void txt(Live live, String text) {
Setting setting = Setting.create();
- text = text.replace("\r\n", "\n");
for (String line : text.split("\n")) {
if (Thread.interrupted()) break;
String[] split = line.split(",");
+ int index = line.indexOf(",") + 1;
if (setting.find(line)) setting.check(line);
if (line.contains("#genre#")) setting.clear();
if (line.contains("#genre#")) live.getGroups().add(Group.create(split[0], live.isPass()));
@@ -104,7 +103,7 @@ public class LiveParser {
if (split.length > 1 && split[1].contains("://")) {
Group group = live.getGroups().get(live.getGroups().size() - 1);
Channel channel = group.find(Channel.create(split[0]));
- channel.addUrls(line.substring(line.indexOf(",") + 1).split("#"));
+ channel.addUrls(line.substring(index).split("#"));
setting.copy(channel);
}
}
@@ -122,6 +121,10 @@ public class LiveParser {
}
}
+ private static String getText(Live live) {
+ return getText(live.getUrl(), live.getHeaders()).replace("\r\n", "\n");
+ }
+
private static String getText(String url, Map header) {
if (url.startsWith("file")) return Path.read(url);
if (url.startsWith("http")) return OkHttp.string(url, header);
diff --git a/app/src/main/java/com/fongmi/android/tv/bean/Track.java b/app/src/main/java/com/fongmi/android/tv/bean/Track.java
index 53c7065a0..f1a9ef373 100644
--- a/app/src/main/java/com/fongmi/android/tv/bean/Track.java
+++ b/app/src/main/java/com/fongmi/android/tv/bean/Track.java
@@ -121,4 +121,8 @@ public class Track {
public static List