|
|
|
|
@ -14,6 +14,7 @@ import android.text.style.ClickableSpan; |
|
|
|
|
import android.view.KeyEvent; |
|
|
|
|
import android.view.View; |
|
|
|
|
import android.view.ViewGroup; |
|
|
|
|
import android.view.WindowManager; |
|
|
|
|
import android.widget.RelativeLayout; |
|
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
|
|
@ -523,6 +524,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
private void getPlayer(Flag flag, Episode episode, boolean replay) { |
|
|
|
|
mBinding.widget.title.setText(getString(R.string.detail_title, mBinding.name.getText(), episode.getName())); |
|
|
|
|
mViewModel.playerContent(getKey(), flag.getFlag(), episode.getUrl()); |
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
|
|
|
updateHistory(episode, replay); |
|
|
|
|
mPlayers.clear(); |
|
|
|
|
mPlayers.stop(); |
|
|
|
|
@ -1104,6 +1106,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
if (mBinding.control.loop.isActivated()) { |
|
|
|
|
onReset(true); |
|
|
|
|
} else { |
|
|
|
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
|
|
|
checkNext(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -1131,18 +1134,11 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN) |
|
|
|
|
public void onErrorEvent(ErrorEvent event) { |
|
|
|
|
if (isBackground()) return; |
|
|
|
|
if (mPlayers.error()) checkError(event); |
|
|
|
|
if (event.isDecode() && mPlayers.canToggle()) onDecode(); |
|
|
|
|
else if (mPlayers.retried()) onError(event); |
|
|
|
|
else onRefresh(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkError(ErrorEvent event) { |
|
|
|
|
if (event.getCode() / 1000 == 4 && mPlayers.addCount() <= 2) { |
|
|
|
|
onDecode(); |
|
|
|
|
} else { |
|
|
|
|
onError(event); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onError(ErrorEvent event) { |
|
|
|
|
Track.delete(getHistoryKey()); |
|
|
|
|
showError(event.getMsg()); |
|
|
|
|
@ -1265,6 +1261,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onPaused(boolean visible) { |
|
|
|
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
|
|
|
mBinding.widget.exoDuration.setText(mPlayers.getDurationTime()); |
|
|
|
|
mBinding.widget.exoPosition.setText(mPlayers.getPositionTime(0)); |
|
|
|
|
if (visible) showInfo(); |
|
|
|
|
@ -1273,6 +1270,7 @@ public class VideoActivity extends BaseActivity implements CustomKeyDownVod.List |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onPlay() { |
|
|
|
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); |
|
|
|
|
mPlayers.play(); |
|
|
|
|
hideCenter(); |
|
|
|
|
} |
|
|
|
|
|