I am playing a video using an instance of AVPlayer, and I want to continue listening to background music while playing the video.
If any background application plays music, the music is turned off every time it is called playon AVPlayer. How can I turn off background sound?
This is how I create and run my AVPlayer:
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:videoURL options:nil];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];
playerLayer = [AVPlayerLayer playerLayerWithPlayer:player];
[self.layer addSublayer:playerLayer];
[player play];
source
share