I've tried numerous methods on the internet but none have worked. Can anybody help? It seems impossible
It's hard to say without seeing the view transition of your app.How do I mute the video in Swift UI, as this would sort my problem entirely?
So just a simplified example:
Code Block struct ContentView: View { let avPlayer = AVPlayer(url: Bundle.main.url(forResource: "video", withExtension: "mov")!) var body: some View { VideoPlayer(player: avPlayer) .onDisappear { avPlayer.isMuted = false } } }
Where you can access avPlayer, you can call methods (or modify properties) of AVPlayer in some action closure appropriate.
If the view transitions of your app is more complex and you need to call AVPlayer methods from within more Views, you may need to consider how to share the same instance avPlayer among such Views.