Is it possible to mute MPMoviePlayerController?

2019-03-16 18:03发布

In my iPhone application I want to mute & unmute MPMoviePlayerController. I have searched a lot but I am unable to succeed. Is it possible to mute audio in MPMoviePlayer controller? Please help me out. Thanks in advance.

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-03-16 18:31

Use this to mute.

NSError *error;
if ( ![[AVAudioSession sharedInstance] setActive:NO error:&error] ) {
    NSLog(@"Error encountered: %@", [error localizedDescription]);
}

You will have to include the AVFoundation framework.

查看更多
祖国的老花朵
3楼-- · 2019-03-16 18:32
[[MPMusicPlayerController applicationMusicPlayer] setVolume:0];

This Line will mute the sound(hopefully)..:)

查看更多
登录 后发表回答