mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-20 03:24:50 +00:00
add background playback support for videos without an explicit audio source
Changelog: changed
This commit is contained in:
parent
891d3cf966
commit
da58b72f9d
2 changed files with 18 additions and 13 deletions
|
@ -870,20 +870,18 @@ class VideoDetailView : ConstraintLayout {
|
|||
}
|
||||
_slideUpOverlay?.hide();
|
||||
} else null,
|
||||
if(!isLimitedVersion)
|
||||
RoundButton(context, R.drawable.ic_screen_share, context.getString(R.string.background), TAG_BACKGROUND) {
|
||||
if(!allowBackground) {
|
||||
_player.switchToAudioMode();
|
||||
allowBackground = true;
|
||||
it.text.text = resources.getString(R.string.background_revert);
|
||||
}
|
||||
else {
|
||||
_player.switchToVideoMode();
|
||||
allowBackground = false;
|
||||
it.text.text = resources.getString(R.string.background);
|
||||
}
|
||||
_slideUpOverlay?.hide();
|
||||
if (!isLimitedVersion) RoundButton(context, R.drawable.ic_screen_share, if (allowBackground) context.getString(R.string.background_revert) else context.getString(R.string.background), TAG_BACKGROUND) {
|
||||
if (!allowBackground) {
|
||||
_player.switchToAudioMode();
|
||||
allowBackground = true;
|
||||
it.text.text = resources.getString(R.string.background_revert);
|
||||
} else {
|
||||
_player.switchToVideoMode();
|
||||
allowBackground = false;
|
||||
it.text.text = resources.getString(R.string.background);
|
||||
}
|
||||
_slideUpOverlay?.hide();
|
||||
}
|
||||
else null,
|
||||
if(!isLimitedVersion)
|
||||
RoundButton(context, R.drawable.ic_download, context.getString(R.string.download), TAG_DOWNLOAD) {
|
||||
|
|
|
@ -298,6 +298,12 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
|
|||
builder = builder.setMaxAudioBitrate(_targetTrackAudioBitrate);
|
||||
}
|
||||
|
||||
builder = if (isAudioMode) {
|
||||
builder.setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, true)
|
||||
} else {
|
||||
builder.setTrackTypeDisabled(C.TRACK_TYPE_VIDEO, false)
|
||||
}
|
||||
|
||||
val trackSelector = exoPlayer?.player?.trackSelector;
|
||||
if(trackSelector != null) {
|
||||
trackSelector.parameters = builder.build();
|
||||
|
@ -737,6 +743,7 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
|
|||
val sourceAudio = _lastAudioMediaSource;
|
||||
val sourceSubs = _lastSubtitleMediaSource;
|
||||
|
||||
updateTrackSelector()
|
||||
|
||||
beforeSourceChanged();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue