views:

318

answers:

1

I can't seem to get this working using stringByEvaluatingJavascriptFromString. Apparently the webview does something peculiar to youtube videos (due to the YouTubePlugIn.webplugin perhaps?) and the javascript API is unusable.

The problem I'm having: How do I pause\stop a video when the user navigates away from a UIWebView with an embedded YouTube video?

Right now the only thing I can think off is reloading the view from a string before navigating away... but that seems heavy and hackish.

Has anyone had any luck with this?

A: 

Loading an empty string is the only thing I have found that works right now.

I am trying to play the video in a popover, and clicking off the popover (closing it), causes the sound to still play in the background until a new video is selected. The solution to this is to load an empty string. Unfortunately, if they fullscreen, clicking off the popover to close it (because it sits on top of the fullscreen video) loads the empty string, and then the entire application crashes. :(

Nick