I’m embedding YouTube videos in a UIWebView for an iOS app. I’m using “Method 2” at this YouTube blog post to embed the video. This works great, except that because iOS manages the media player, I can’t determine whether the video is playing or is done. I don’t want to swap that view out with another one while the video is playing, but I don’t see a good way to determine that. Any ideas? If there’s a way to get a JavaScript callback, that will work, or if there’s a way to embed YouTube videos using the HTML5 <video> tag, that will work as well (I’ve tried that and not gotten success).
I’m embedding YouTube videos in a UIWebView for an iOS app. I’m using Method
Share
you can inject javascript into a
UIWebView(see http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview)… other interesting stuff about javascript andUIWebViewcan be found here and here.try using this together with this experimental youtube API (see http://code.google.com/apis/youtube/iframe_api_reference.html)… this should be able to get you what you want.
Another useful resource for this to make a callback from javascript to your code is here.