Avplayer

AVPlayer

Listeners

Observer to see when the video playback started

player = AVPlayer(url: URL(fileURLWithPath: path))
player.addObserver(self, forKeyPath: "rate", options: NSKeyValueObservingOptions.new, context: nil)

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
    if keyPath == "rate" {
        if player.rate > 0 {
            print("video started")
        }
    }
}

Knowing when AVPlayer object is ready to play

How to detect AVPlayer actually started to play in swift

How to detect user selection of subtitles when using AVPlayerViewController

Selecting Tracks AV Media Playback

Selecting Subtitles and Alternative Audio Tracks

AVAsset

Media playback

Muting Audio

if IsMuted == false {
      IsMuted = true
      musicPlayer.volume = 0
    } else {
      IsMuted = false
      musicPlayer.volume = 1
    }
}