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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
[[MPMusicPlayerController applicationMusicPlayer] setVolume:0];
This Line will mute the sound(hopefully)..:)
回答2:
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.