Embed video in html file loaded in UIWebView from Documents folder of application

后端 未结 5 2077
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 10:23

I have an html file named videoplay.html with following content




    Title         


        
5条回答
  •  情话喂你
    2021-02-13 11:00

    Why use an HTML file to play the video and not use MPMoviePlayerViewController?

    NSURL *assetURL = [NSURL fileURLWithPath:<#path_to_movie#>];
    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:assetURL];  
    
    if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
        // Use the new 3.2 style API  
        moviePlayer.shouldAutoplay = YES;  
        [_delegate.view addSubview:moviePlayer.view];
        [moviePlayer setFullscreen:YES animated:YES];  
    } else {  
        // Use the old 2.0 style API
        [moviePlayer play];
    }
    

    Doesn't this work for you?

提交回复
热议问题