开发者

Keeping the volume controls on even with vibrate switch on using MPMoviePlayerViewController like YouTube app does

We have an application that uses the MPMov开发者_Python百科iePlayerViewController and our customer noticed that when the vibrate switch is on, the sound is off and the volume controls are taken away. That seems to be standard behavior.

Now I was expecting the YouTube app to have the same behavior but they don't. When you turn the switch on, you can play YouTube clips and the sound is on and the volume controls are available.

Any idea on how they achieved that?


Set the audio session category for your app for media playback:

AudioSessionInitialize(NULL, NULL, NULL, NULL);
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory);

You can see the various audio categories that are available to your app here: Audio Session Categories


By having access to undocumented APIs. The Youtube app on iPhones is an Apple app, meaning they can simply do stuff that you can't.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜