Playing .m3u8 file on iOS

前端 未结 1 867
暖寄归人
暖寄归人 2021-02-04 16:39

I have .m3u8 link which I need to play on iOS which supports the HLS Protocol.

When I assign URL directly to the MPMoviePl

相关标签:
1条回答
  • 2021-02-04 17:30

    Import:

    #import <MediaPlayer/MediaPlayer.h>
    

    Then do:

    NSURL *movieURL = [NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"];
    MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    
    if (mp) {
        mp.view.frame = self.view.bounds;
        [self.view addSubview:mp.view];
    
        // save the movie player object
        [mp setFullscreen:YES];
    
        // Play the movie!
        [mp play];
    
        self.moviePlayer = mp;
    }
    
    0 讨论(0)
提交回复
热议问题