This commit is contained in:
Trey t
2023-07-03 20:18:08 -05:00
parent 5c66ceff9f
commit 85dfc0a931
8 changed files with 190 additions and 80 deletions

View File

@@ -31,6 +31,8 @@ struct VideoPlayerView: View {
VideoPlayer(player: avPlayer)
.onAppear{
_ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: .mixWithOthers)
avPlayer.play()
}
}
@@ -38,8 +40,13 @@ struct VideoPlayerView: View {
.onReceive(pub) { (output) in
avPlayer.pause()
avPlayer.seek(to: .zero)
_ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: .mixWithOthers)
avPlayer.play()
}
.onChange(of: avPlayer, perform: { newValue in
avPlayer.play()
})
}
}