mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 10:55:03 +00:00
Pause tvOS playback on seek bar scrub mode entry
This commit is contained in:
@@ -49,6 +49,10 @@ struct TVPlayerView: View {
|
|||||||
/// Whether user is scrubbing the progress bar.
|
/// Whether user is scrubbing the progress bar.
|
||||||
@State private var isScrubbing = false
|
@State private var isScrubbing = false
|
||||||
|
|
||||||
|
/// Whether playback was active when the current scrub session began;
|
||||||
|
/// used to decide whether to resume on scrub end.
|
||||||
|
@State private var wasPlayingBeforeScrub = false
|
||||||
|
|
||||||
/// Whether the quality sheet is shown.
|
/// Whether the quality sheet is shown.
|
||||||
@State private var showingQualitySheet = false
|
@State private var showingQualitySheet = false
|
||||||
|
|
||||||
@@ -237,8 +241,16 @@ struct TVPlayerView: View {
|
|||||||
isScrubbing = scrubbing
|
isScrubbing = scrubbing
|
||||||
if scrubbing {
|
if scrubbing {
|
||||||
stopControlsTimer()
|
stopControlsTimer()
|
||||||
|
wasPlayingBeforeScrub = playerService?.state.playbackState == .playing
|
||||||
|
if wasPlayingBeforeScrub {
|
||||||
|
playerService?.pause()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
startControlsTimer()
|
startControlsTimer()
|
||||||
|
if wasPlayingBeforeScrub {
|
||||||
|
playerService?.resume()
|
||||||
|
}
|
||||||
|
wasPlayingBeforeScrub = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remoteSeekTime: scrubberRemoteSeekTime,
|
remoteSeekTime: scrubberRemoteSeekTime,
|
||||||
|
|||||||
Reference in New Issue
Block a user