简体   繁体   中英

Detect if a media (video or audio) is playing on iOS

I'm working on App that uses Airplay. As part of the requirements, I need to detect if a video is playing on the device to stop the Airplay streaming.

Is there any way to achieve this?

You can use;

isOtherAudioPlaying

A Boolean value that indicates whether another app is playing audio.

AVAudioSession.sharedInstance().isOtherAudioPlaying

or

secondaryAudioShouldBeSilencedHint

A Boolean value that indicates whether another application is playing audio.

AVAudioSession.sharedInstance().secondaryAudioShouldBeSilencedHint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM