晓霞提出的一个问题,uber播放视频不打断后台MP3的播放,怎么实现
找了几天原因发现原来是avplay播放session的切换问题。
一,聊天语音的录音与播放
二,视频播放
//播放视频时先将音乐播放频道切换到环绕音,不然播放视频时会打断听音乐这里有个同时播放的demo https://github.com/MZimmerman6/FireplaceReceiver
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryAmbient error: nil
];
NSURL *movieURL = [NSURL fileURLWithPath
:
[[
NSBundle mainBundle] pathForResource:@"fireplace"
ofType:@"mp4"
]];
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL
:movieURL];
[[
self.moviePlayer view] setFrame:CGRectMake(-221, -166, 1466, 1100
)];
[
self.view addSubview:self.moviePlayer.view
];
[
self.moviePlayer prepareToPlay
];
[
self.moviePlayer setScalingMode:MPMovieScalingModeAspectFill
];
[
self.moviePlayer setRepeatMode:MPMovieRepeatModeOne
];
[
self.moviePlayer setControlStyle:MPMovieControlStyleNone
];
[
self.moviePlayer play];
1,流媒体制作与播放