
MPMovIEPlayerController正在播放视频,音频只能通过耳机播放.
真正的拖累是,这只发生在一些iPad和iPhone上,甚至是同样的模型
运行相同的系统!
我在这里创建了一个简单的失败示例:
http://www.porcaro.org/MPMoviePlayerController/TestMovie.zip
我已经看到它在iPhone 4S,iPhone 4和iPad 2上运行正常并且失败了.
这是最相关的代码.感谢您的任何见解,我也将向Apple提交一个错误:
(voID)vIEwDIDAppear:(BOol)animated{ [super vIEwDIDAppear:animated]; movIEPath = [Nsstring stringWithFormat:@"%@/intro.m4v",[[NSBundle mainBundle] bundlePath]]; NSURL *movIEURL = [NSURL fileURLWithPath:movIEPath]; theMovIEPlayer = [[MPMovIEPlayerController alloc] initWithContentURL:movIEURL]; controlStyle = MPMovIEControlStyleEmbedded; movIEVIEw = [self vIEw]; movIERect = [[self vIEw] frame]; controlStyle = MPMovIEControlStyleFullscreen; theMovIEPlayer.controlStyle = controlStyle; theMovIEPlayer.vIEw.userInteractionEnabled = YES; if (1) { NSLog(@"Created theMovIEPlayer: %@. Playing: %@",theMovIEPlayer,movIEPath); } [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMovIEPlayerPlaybackStateDIDChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addobserver:self selector:@selector(checkForEndOfMovIE:) name:MPMovIEPlayerPlaybackStateDIDChangeNotification object:theMovIEPlayer]; // this line doesn't fix the problem //[theMovIEPlayer preparetoPlay]; [[theMovIEPlayer vIEw] setFrame:movIERect]; [movIEVIEw addSubvIEw: [theMovIEPlayer vIEw]]; [theMovIEPlayer play];}解决方法 这是一个古老的问题,但也许它会帮助某人.我遇到了同样的问题,发现只有手机处于静音模式时才会发生这种情况. 解决方案是将播放器的useApplicationAudioSession属性设置为false.
[theMovIEPlayer setUseApplicationAudioSession:NO];总结
以上是内存溢出为你收集整理的ios – 声音仅通过MPMoviePlayerController在某些设备上通过耳机播放全部内容,希望文章能够帮你解决ios – 声音仅通过MPMoviePlayerController在某些设备上通过耳机播放所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)