Check if video has audio or not

我的未来我决定 提交于 2019-12-24 13:59:02

问题


I have to make decision if a video file (streaming from server) has audio or not. If it has audio then I have to stop already playing audio file and start video else play video with already running audio. I have managed to pause audio before playing video but how can I check audio in a video?

I am using AVAudioPlayer to play audio and MPMoviePlayerViewController to play video.

I have searched a lot on google but no success. Any help will be appreciated.


回答1:


http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html#//apple_ref/doc/c_ref/MPMoviePlayerController

If you navigate to the notifications section, you will see that there is a notification:

MPMovieMediaTypesAvailableNotification

And here are the masks for given notification:

MPMovieMediaTypeMask  
enum {
   MPMovieMediaTypeMaskNone  = 0,
   MPMovieMediaTypeMaskVideo = 1 << 0,
   MPMovieMediaTypeMaskAudio = 1 << 1
};
typedef NSInteger MPMovieMediaTypeMask;


来源:https://stackoverflow.com/questions/16063209/check-if-video-has-audio-or-not

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!