开发者

Get notifications when a Dailymotion video is played into a UIWebView

I'm currently showing a dailymotion url directly into a UIWebview. When tapping on the thumbnail image, the video starts playing in fullscreen mode.

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.

I've been looking around and playing with the Notification center but I couldn't get any response, can you tell me what code I should use ?

loading the video

    NSURLRequest *requestObject = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.dailymotion.com/embed/video/xh7cgv_cine-pocket-a-candidate_creation"]];
[self.webv loadRequest:requestObject];

notification catch

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayerDidExitFullscreen:)
                                             name:MPMoviePlayerDidExitFullscreenNotification
                                           object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayerDidEnterFullscreenNotification:)
                                             name:MPMoviePlayerDidEnterFullscreenNotification
                                           object:nil];
[[NSNoti开发者_C百科ficationCenter defaultCenter] addObserver:self
                                         selector:@selector(playbackDidFinish:) 
                                             name:MPMoviePlayerPlaybackDidFinishNotification 
                                           object:nil];

thanks, Louis


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜