MPMoviePlayerViewController 拔下耳机时停止播放
我目前正在开发一个使用 MPMoviePlayerViewController 和 MPMoviePlayerViewController 的网络电视应用程序。 MPMoviePlayer 可在 iPhone 上播放流媒体视频内容。
我遇到的问题是,一旦我拔掉耳机(在看电视时),播放器就会停止。 由于我没有显示标准控件(上一个按钮、播放/暂停按钮、下一个按钮),而是显示我的自定义控件,用户会被冻结的图片困住,除非他切换到新频道
。如何检测因拔掉耳机而导致的播放中断?
感谢您提前提供的提示和技巧,
山姆
I'm currently developing a web-tv application that uses MPMoviePlayerViewController resp. MPMoviePlayer to playback streaming video content on the iphone.
the issue I've got here is that once i unplug my headphones (while watching tv) the player stops.
Due to the fact that I'm not showing the standard controls (previous button, play/pause button, next button) but my custom controlls, the user is stuck with the frozen picture unless he switches to a new channel..
is there any way to detect a playback interuption caused by unplugging the headphones?
thanks for your tipps and tricks in advance,
sam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我没有直接回答你的问题。但我认为 MPMoviePlayerPlaybackStateDidChangeNotification 足以解决您的问题。收到通知后,从电影播放器对象的playbackState 属性获取播放状态并采取适当的操作。
I don't have a direct answer to your question. But I think MPMoviePlayerPlaybackStateDidChangeNotification will be good enough to solve your issue. Once you are notified, Get the playback state from the playbackState property of the movie player object and take appropriate action.
用一些代码详细说明已接受的答案:
Elaborating on the accepted answer with some code: