Video Player: Pause video when onDisappear
This commit is contained in:
parent
27164fa399
commit
04b5804c96
|
@ -68,6 +68,9 @@ struct VideoPlayerView: View {
|
||||||
}.onAppear {
|
}.onAppear {
|
||||||
viewModel.preparePlayer(autoPlay: preferences.autoPlayVideo)
|
viewModel.preparePlayer(autoPlay: preferences.autoPlayVideo)
|
||||||
}
|
}
|
||||||
|
.onDisappear {
|
||||||
|
viewModel.pause()
|
||||||
|
}
|
||||||
.cornerRadius(4)
|
.cornerRadius(4)
|
||||||
.onChange(of: scenePhase, perform: { scenePhase in
|
.onChange(of: scenePhase, perform: { scenePhase in
|
||||||
switch scenePhase {
|
switch scenePhase {
|
||||||
|
|
Loading…
Reference in New Issue