ios AVAudioSession多路视频数据播放声音问题

ios. 当需要同时播放多路视频流时发现 如果采用模式

AVAudioSessionCategoryPlayAndRecord

,则后续加入播放的视频流则无法走扬声器播放;而且,如果先播放在设置该模式,发现不太好使,有时能用,有时没效果;

因此,在网上查资料发现,可以采用如下模式

AVAudioSessionCategoryMultiRoute

开启多路视频流的支持,这样就不会有问题了;

    dispatch_async(dispatch_get_main_queue(), ^{
        [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryMultiRoute withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth error:nil];
	 [[AVAudioSession sharedInstance] setActive:YES error:nil];
    });

发布了172 篇原创文章 · 获赞 35 · 访问量 39万+

猜你喜欢

转载自blog.csdn.net/u012198553/article/details/91042954