Search code examples
iosobjective-cuiwebviewmpmovieplayercontroller

MPMoviePlayerViewController is playing video in background


i have a UIWebView that loads URLs from Address Bar, problem is that when i visit video website in this and open a video it loads that video in fullscreen, Now at the moment video is playing as topmost ViewController, i get some NSNotification "that i have added over AppDelegate" to dismiss currently playing video and do some other stuff.. i dismiss the MPMoviePlayerViewController

[navController dismissMoviePlayerViewControllerAnimated];

it just hide MPMoviePlayerViewController View while the video is still playing in background, My question is that how can i dismiss MPMoviePlayerViewController permanantly so that everything get stop..


Solution

  • i solved this issue by just first dismissing MoviePlayerViewController by

    [nav.view.window.rootViewController dismissMoviePlayerViewControllerAnimated];
    

    and after dismissing Player i just reload UIWebview by again requesting the url as

     [self.webView loadRequest:urlRequest];