简体   繁体   English

使用AVFoundation播放无声电影并保持iPod音乐播放

[英]Playing a silent movie with AVFoundation and keeping iPod music playing

I have an app that plays silent Movies using AVFoundation. 我有一个使用AVFoundation播放无声电影的应用程序。 Is there a way to allow the music to play and your iPod (if you're playing music) to continue playing? 有没有办法允许音乐播放并让iPod(如果正在播放音乐)继续播放? If I play the movie will my iPod is on, the iPod pauses so the movie can play, and vice versa - if I try to replay the music while the movie is playing, the movie pauses. 如果我播放电影,并且iPod处于开启状态,则iPod会暂停,以便可以播放电影,反之亦然-如果我在播放电影时尝试重播音乐,则电影会暂停。 Basically, I want them to play continue playing seamlessly.... 基本上,我希望他们继续无缝播放。

Let me know if you need applicable code to answer. 让我知道您是否需要适用的代码来回答。

In my experience, for standard AVAudioPlayer based sound in an app, managing the AVAudioSession is required to allow background music: 以我的经验,对于应用程序中基于标准AVAudioPlayer的声音,需要管理AVAudioSession才能允许背景音乐:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];

But I can't tell you if that's the same as attempting to play encoded/compressed Video and encoded/compressed audio at the same time. 但是我不能告诉您这与尝试同时播放编码/压缩的视频和编码/压缩的音频是否相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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