mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-27 11:49:03 +00:00
On casting device disconnect, only set play when ready to true if it was also playing on the TV device.
This commit is contained in:
parent
3d7b347e49
commit
1fb55dca0a
1 changed files with 4 additions and 4 deletions
|
@ -649,7 +649,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isInEditMode) {
|
if (!isInEditMode) {
|
||||||
StateCasting.instance.onActiveDeviceConnectionStateChanged.subscribe(this) { _, connectionState ->
|
StateCasting.instance.onActiveDeviceConnectionStateChanged.subscribe(this) { device, connectionState ->
|
||||||
if (_onPauseCalled) {
|
if (_onPauseCalled) {
|
||||||
return@subscribe;
|
return@subscribe;
|
||||||
}
|
}
|
||||||
|
@ -661,7 +661,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
setCastEnabled(true);
|
setCastEnabled(true);
|
||||||
}
|
}
|
||||||
CastConnectionState.DISCONNECTED -> {
|
CastConnectionState.DISCONNECTED -> {
|
||||||
loadCurrentVideo(lastPositionMilliseconds);
|
loadCurrentVideo(lastPositionMilliseconds, playWhenReady = device.isPlaying);
|
||||||
updatePillButtonVisibilities();
|
updatePillButtonVisibilities();
|
||||||
setCastEnabled(false);
|
setCastEnabled(false);
|
||||||
|
|
||||||
|
@ -1880,7 +1880,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Source Loads
|
//Source Loads
|
||||||
private fun loadCurrentVideo(resumePositionMs: Long = 0) {
|
private fun loadCurrentVideo(resumePositionMs: Long = 0, playWhenReady: Boolean = true) {
|
||||||
_didStop = false;
|
_didStop = false;
|
||||||
|
|
||||||
val video = (videoLocal ?: video) ?: return;
|
val video = (videoLocal ?: video) ?: return;
|
||||||
|
@ -1925,7 +1925,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
else
|
else
|
||||||
_player.setArtwork(null);
|
_player.setArtwork(null);
|
||||||
}
|
}
|
||||||
_player.setSource(videoSource, audioSource, _playWhenReady, false, resume = resumePositionMs > 0);
|
_player.setSource(videoSource, audioSource, _playWhenReady && playWhenReady, false, resume = resumePositionMs > 0);
|
||||||
if(subtitleSource != null)
|
if(subtitleSource != null)
|
||||||
_player.swapSubtitles(fragment.lifecycleScope, subtitleSource);
|
_player.swapSubtitles(fragment.lifecycleScope, subtitleSource);
|
||||||
_player.seekTo(resumePositionMs);
|
_player.seekTo(resumePositionMs);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue