在将Dailymotion视频播放到UIWebView时获取通知 [英] Get notifications when a Dailymotion video is played into a UIWebView
问题描述
我目前正在直接在UIWebview中显示一个Dailymotion网址. 点击缩略图时,视频开始以全屏模式播放.
I'm currently showing a dailymotion url directly into a UIWebview. When tapping on the thumbnail image, the video starts playing in fullscreen mode.
问题是:当视频停止播放或用户轻按完成"按钮时,原始缩略图已从UIWebview中消失,从而无法再次启动视频. 我想控制视频何时结束播放或用户点击完成按钮重新加载UIWebView.
The problem is: when the video stops playing or the user tapps the "done" button, the original thumbnail has disapeared from the UIWebview, making it impossible to launch the video again. I would like to control when the video has finished playing or the user has tapped the done button to reload the UIWebView.
我一直在到处访问通知中心,但没有得到任何答复,您能告诉我应该使用什么代码吗?
加载视频
NSURLRequest *requestObject = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.dailymotion.com/embed/video/xh7cgv_cine-pocket-a-candidate_creation"]];
[self.webv loadRequest:requestObject];
通知捕获
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerDidExitFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerDidEnterFullscreenNotification:)
name:MPMoviePlayerDidEnterFullscreenNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playbackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
谢谢, 路易斯
推荐答案
对应于此可见的隐藏事件黑客,子视图事件攻击.如果运气好的话,请分享一些代码!
corresponding to this thread the MediaPlayer doesn't send out any notifications when started from within the UIWebView (no source given however). you could try these hacks: visible-hidden events hack, timed key window checking-hack, subview events-hack. If you had luck, please share some code!
这篇关于在将Dailymotion视频播放到UIWebView时获取通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!