开发者

programmatically off the sound on tapping mute button on iphone

开发者 https://www.devze.com 2023-03-19 20:11 出处:网络
How to programmatically disable the sound when mute button开发者_如何学C of iphone pressed while playing audio file?

How to programmatically disable the sound when mute button开发者_如何学C of iphone pressed while playing audio file? I'm using streamer for audio.


This may help you

Now, here is something from MediaPlayer framework that we are going to use if we want in most easiest way control level of volume in our application. This is very useful if you are implementing an audio player in your app.

The best thing about this small feature is easy implementation in any class. We just import MediaPlayer framework in header of our class (#import ) and add this code below in method we know that is appropriate for this feature (init method).

MPVolumeView *volumeView = [[[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 200, 20)] autorelease];

volumeView.center = CGPointMake(150,370);
[volumeView sizeToFit];

[self.view addSubview:volumeView];

This kind of volume control is connected with iPhone hardware volume buttons. You get same thing like in Music player.


You have to use the audio framework of the iOS SDK and choose the correct profile. The system automatically decides if muting is appropriate.

Apple explains it here. :-)


probably you can use .... if you are using MPMoviewPlayerController and intend to control the volume using mpvolumeview

         [[MPMusicPlayerController applicationMusicPlayer] setVolume: 0.0];
0

精彩评论

暂无评论...
验证码 换一张
取 消