本文介绍了Youtube 解散事件(iOS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,

通过使用 UIWebview,我现在有了一种在我的应用程序中显示 youtube 视频的工作方法(使用标签,在 webview 中找到播放按钮并在其上触发触摸事件).

Through the use of an UIWebview I have now a working method to show a youtube video within my app (using the tag, finding the play button within the webview and firing the touch event on that).

就像一个魅力.视频弹出并播放.但是,我想在视频结束或用户单击完成按钮时收到一个事件.

Works like a charm. The video pops up and plays. However I would like to recieve an event when the video ends or the user clicks the done button.

在互联网上,我发现有一个事件:MPAVControllerItemPlaybackDidEndNotification,您可以在其中收听.但是这个没有被调用.

On the internet I have found that there is an event: MPAVControllerItemPlaybackDidEndNotification where you can listen to. However this one does not get called.

经过进一步研究,我发现对于通过 UIWebView 嵌入的 Youtube 视频,另一个通知被称为( UIMoviePlayerControllerDidExitFullscreenNotification ).不幸的是,那个也不再起作用了.( 在这里找到)

After some further research I found that for Youtube Videos embedded through UIWebView another notification was called ( UIMoviePlayerControllerDidExitFullscreenNotification ). Unfortunately that one does not work either anymore. ( found it here )

有谁知道我在视频播放完毕或被关闭后如何做一些动作?

Does anyone have any idea how I can do some action after the video is done playing or has been dismissed?

谢谢

推荐答案

使用 UIMoviePlayerControllerWillExitFullscreenNotification 来在用户点击 DONE 按钮时获得通知.UIMoviePlayerControllerDidExitFullscreenNotification 似乎确实在 iOS6 上被省略了.

Use the UIMoviePlayerControllerWillExitFullscreenNotification for getting notified once the user tapped on the DONE button. The UIMoviePlayerControllerDidExitFullscreenNotification seems indeed to be omitted on iOS6.

请注意...Did......Will... 的区别!

Mind that ...Did... vs. ...Will... difference!

有关该主题的更多信息,请再次查看您在问题中引用的帖子中的更新答案.

For more on that subject, once again check my updated answer within that posting you referenced in your question.

这篇关于Youtube 解散事件(iOS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 02:51