Search code examples
iphoneobjective-cipaduiwebview

Stop video in UIWebView


In my iPad App I have a modal view (UIViewController with modal presentation style UIModalPresentationPageSheet)

Inside the view is a UIWebView with a HTML page and an embedded YouTube-Video. If I start the video and close the view, the video doesn't stop. The audio continues and you can see a small "play icon" next to the "battery icon" in the status bar.

How can I stop the video?


Solution

  • Do integrate following code to sort out the problem.

        -(void)viewWillDisappear:(BOOL)animated
        {
            [webView loadHTMLString:nil baseURL:nil];
        }