mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-09 09:39:51 +00:00
Merge branch 'playback-stutter-fix' into 'master'
background playback stutter fix See merge request videostreaming/grayjay!103
This commit is contained in:
commit
8ca317a38a
4 changed files with 13 additions and 9 deletions
|
@ -487,11 +487,6 @@ class Settings : FragmentedStorageFileJson() {
|
|||
@FormField(R.string.live_chat_webview, FieldForm.TOGGLE, R.string.use_the_live_chat_web_window_when_available_over_native_implementation, 9)
|
||||
var useLiveChatWindow: Boolean = true;
|
||||
|
||||
|
||||
|
||||
@FormField(R.string.background_switch_audio, FieldForm.TOGGLE, R.string.background_switch_audio_description, 10)
|
||||
var backgroundSwitchToAudio: Boolean = true;
|
||||
|
||||
@FormField(R.string.restart_after_audio_focus_loss, FieldForm.DROPDOWN, R.string.restart_playback_when_gaining_audio_focus_after_a_loss, 11)
|
||||
@DropdownFieldOptionsId(R.array.restart_playback_after_loss)
|
||||
var restartPlaybackAfterLoss: Int = 1;
|
||||
|
|
|
@ -1115,7 +1115,7 @@ class VideoDetailView : ConstraintLayout {
|
|||
when (Settings.instance.playback.backgroundPlay) {
|
||||
0 -> handlePause();
|
||||
1 -> {
|
||||
if(!(video?.isLive ?: false) && Settings.instance.playback.backgroundSwitchToAudio)
|
||||
if(!(video?.isLive ?: false))
|
||||
_player.switchToAudioMode();
|
||||
StatePlayer.instance.startOrUpdateMediaSession(context, video);
|
||||
}
|
||||
|
|
|
@ -252,12 +252,22 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
|
|||
fun switchToVideoMode() {
|
||||
Logger.i(TAG, "Switching to Video Mode");
|
||||
isAudioMode = false;
|
||||
loadSelectedSources(playing, true);
|
||||
val player = exoPlayer ?: return
|
||||
player.player.trackSelectionParameters =
|
||||
player.player.trackSelectionParameters
|
||||
.buildUpon()
|
||||
.setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, isAudioMode)
|
||||
.build()
|
||||
}
|
||||
fun switchToAudioMode() {
|
||||
Logger.i(TAG, "Switching to Audio Mode");
|
||||
isAudioMode = true;
|
||||
loadSelectedSources(playing, true);
|
||||
val player = exoPlayer ?: return
|
||||
player.player.trackSelectionParameters =
|
||||
player.player.trackSelectionParameters
|
||||
.buildUpon()
|
||||
.setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, isAudioMode)
|
||||
.build()
|
||||
}
|
||||
|
||||
fun seekTo(ms: Long) {
|
||||
|
|
|
@ -429,7 +429,6 @@
|
|||
<string name="seek_offset">Seek duration</string>
|
||||
<string name="seek_offset_description">Fast-Forward / Fast-Rewind duration</string>
|
||||
<string name="background_switch_audio">Switch to Audio in Background</string>
|
||||
<string name="background_switch_audio_description">Optimize bandwidth usage by switching to audio-only stream in background if available, may cause stutter</string>
|
||||
<string name="subscription_group_menu">Groups</string>
|
||||
<string name="show_subscription_group">Show Subscription Groups</string>
|
||||
<string name="use_subscription_exchange">Use Subscription Exchange (Experimental)</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue