mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-05-04 11:59:18 -05:00
player: restore speed fix
This commit is contained in:
+6
-19
@@ -159,7 +159,9 @@ public class VideoStateController extends PlayerEventListenerHelper implements M
|
||||
}
|
||||
|
||||
// Restore speed on LIVE end
|
||||
restoreSpeed();
|
||||
if (isLiveThreshold()) {
|
||||
restoreSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -249,28 +251,13 @@ public class VideoStateController extends PlayerEventListenerHelper implements M
|
||||
showHideScreensaver(true);
|
||||
|
||||
// Restore speed on LIVE end or after seek
|
||||
restoreSpeed();
|
||||
if (isLiveThreshold()) {
|
||||
restoreSpeed();
|
||||
}
|
||||
|
||||
Utils.postDelayed(mStreamEndCheck, 10_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSeekEnd() {
|
||||
// Scenario: user opens ui and does some seeking
|
||||
// NOTE: dangerous: there's possibility of simultaneous seeks (e.g. when sponsor block is enabled)
|
||||
//saveState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onControlsShown(boolean shown) {
|
||||
// NOTE: bug: current position saving to wrong video id. Explanation below.
|
||||
// Bug in casting: current video doesn't match currently loaded one into engine.
|
||||
//if (shown) {
|
||||
// // Scenario: user clicked on channel button
|
||||
// saveState();
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSourceChanged(Video item) {
|
||||
// At this stage video isn't loaded yet. So format switch isn't take any resources.
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ import com.google.android.exoplayer2.source.TrackGroupArray;
|
||||
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||
import com.liskovsoft.sharedutils.helpers.Helpers;
|
||||
import com.liskovsoft.sharedutils.mylogger.Log;
|
||||
import com.liskovsoft.smartyoutubetv2.common.BuildConfig;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video;
|
||||
@@ -370,7 +371,7 @@ public class ExoPlayerController implements Player.EventListener, PlayerControll
|
||||
|
||||
@Override
|
||||
public void setSpeed(float speed) {
|
||||
if (mPlayer != null && speed > 0) {
|
||||
if (mPlayer != null && speed > 0 && !Helpers.floatEquals(speed, getSpeed())) {
|
||||
mPlayer.setPlaybackParameters(new PlaybackParameters(speed, mPlayer.getPlaybackParameters().pitch));
|
||||
mCurrentSpeed = speed; // NOTE: backup speed in case params not applied (playback is paused)
|
||||
|
||||
|
||||
@@ -542,6 +542,7 @@ public class PlayerData extends DataChangeBase {
|
||||
|
||||
if (isSpeedPerChannelEnabled() && channelId != null) {
|
||||
speed = mSpeeds.get(channelId);
|
||||
mSpeed = 1.0f; // reset speed if the channel not found
|
||||
}
|
||||
|
||||
if (speed != null) {
|
||||
|
||||
@@ -311,6 +311,8 @@ public class GuidedActionAdapter extends RecyclerView.Adapter {
|
||||
|
||||
// MOD: VoiceView fix
|
||||
Helpers.describedBy(v, R.id.guidance_title);
|
||||
// Or should I add description instead?
|
||||
//v.setContentDescription(theCode);
|
||||
|
||||
setupListeners(vh.getEditableTitleView());
|
||||
setupListeners(vh.getEditableDescriptionView());
|
||||
|
||||
Reference in New Issue
Block a user