mirror of
https://github.com/dirtydishes/dreamio.git
synced 2026-06-06 21:38:15 +00:00
Harden VLC playback controls
This commit is contained in:
parent
6ced219906
commit
62366c0e25
7 changed files with 583 additions and 16 deletions
|
|
@ -34,6 +34,36 @@ protocol NativePlaybackBackend: AnyObject {
|
|||
func stop()
|
||||
}
|
||||
|
||||
enum NativePlaybackToggleState {
|
||||
case opening
|
||||
case buffering
|
||||
case playing
|
||||
case paused
|
||||
case stopped
|
||||
case ended
|
||||
case error
|
||||
case unknown
|
||||
}
|
||||
|
||||
enum NativePlaybackToggleAction {
|
||||
case play
|
||||
case pause
|
||||
case waitForTransition
|
||||
}
|
||||
|
||||
enum NativePlaybackTogglePolicy {
|
||||
static func action(for state: NativePlaybackToggleState) -> NativePlaybackToggleAction {
|
||||
switch state {
|
||||
case .playing, .buffering:
|
||||
return .pause
|
||||
case .paused, .stopped, .ended, .error:
|
||||
return .play
|
||||
case .opening, .unknown:
|
||||
return .waitForTransition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum NativePlaybackError: LocalizedError {
|
||||
case backendUnavailable
|
||||
case startupTimedOut
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue