mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
AVPlayer background music mode
This commit is contained in:
@@ -90,7 +90,7 @@ struct VideoPlayerView: View {
|
||||
Spacer()
|
||||
#endif
|
||||
}
|
||||
#if os(macOS)
|
||||
#if !os(tvOS)
|
||||
.frame(width: player.playerSize.width)
|
||||
#endif
|
||||
|
||||
@@ -103,6 +103,11 @@ struct VideoPlayerView: View {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if player.musicMode {
|
||||
player.backend.startControlsUpdates()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var videoPlayer: some View {
|
||||
@@ -435,10 +440,14 @@ struct VideoPlayerView: View {
|
||||
guard player.presentingPlayer,
|
||||
!playerControls.presentingControlsOverlay else { return }
|
||||
|
||||
if playerControls.presentingControls {
|
||||
if playerControls.presentingControls, !player.musicMode {
|
||||
playerControls.presentingControls = false
|
||||
}
|
||||
|
||||
if player.musicMode {
|
||||
player.backend.stopControlsUpdates()
|
||||
}
|
||||
|
||||
let drag = value.translation.height
|
||||
|
||||
guard drag > 0 else { return }
|
||||
@@ -479,6 +488,10 @@ struct VideoPlayerView: View {
|
||||
}
|
||||
player.backend.setNeedsDrawing(true)
|
||||
player.show()
|
||||
|
||||
if player.musicMode {
|
||||
player.backend.startControlsUpdates()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user