iPhone - 播放电影后恢复背景音乐
我正在后台播放 iTunes 音乐。 我使用以下代码启动了播放“视频”的应用程序:
NSString* videoPath = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"m4v"];
if (player) {
[player release];
player = nil;
}
player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:videoPath]];
[self presentModalViewController:player animated:YES];
我将音频会话设置如下:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive: YES error:nil];
当我的视频开始播放时,后台播放的 iPod 音乐将停止。 视频播放完毕后如何恢复背景音乐?
I'm playing iTunes music in the background.
I started my app which plays "Video" using the following code:
NSString* videoPath = [[NSBundle mainBundle] pathForResource:@"video" ofType:@"m4v"];
if (player) {
[player release];
player = nil;
}
player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:videoPath]];
[self presentModalViewController:player animated:YES];
I'm setting the audio session as follows:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
[[AVAudioSession sharedInstance] setActive: YES error:nil];
When my video starts playing, iPod music playing in the background will be stopped.
How can I resume the background music when my video completes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这种必须从 ipod 继续的选项是不可能的。
This kind of option to continue must from ipod is not possible.
使用通知
Use notifications