简体   繁体   中英

IOS translate to monotouch audio fix ios6

This code is needed for audio bug that seems to be in ios 6 update: My video plays with no audio on ios 6 devices.

Saw this code was a fix but not sure how to translate this to monotouch:

NSError *error= nil;
if ([[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback  
  error:&error]) {
      NSLog(@"Error setting audio session: %@", error);
}

Also not sure where I should even put this code? by the video player creation code or in the open of the viewcontroller the video player is created in?

Is there any way I can cause a memory leak by creating a fresh new instance on each video player creation, if so how do I properly release the resources.

I didn't work previously with AVAudioSession but this answer migh help.

AVAudioSession.SetCategory(your_category, AVAudioSessionCategoryOptions.MixWithOthers, out error);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM