2014-03-03 2 views
7

HLS Protocol을 지원하는 iOS에서 재생해야하는 .m3u8 링크가 있습니다.iOS에서 .m3u8 파일 재생

URL을 MPMoviePlayerController에 직접 지정하고 재생하면 동영상이 보이지 않지만 오디오를들을 수 있습니다.

NSURL *movieURL = [NSURL URLWithString:@"http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8"]; 
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; 
[self.view addSubview:self.moviePlayer.view]; 

if (mp) 
{ 
    // save the movie player object 
    self.moviePlayer = mp; 
    [self.moviePlayer setFullscreen:YES]; 

    // Play the movie! 
    [self.moviePlayer play]; 
} 

iOS 쪽을 어떻게 처리해야합니까?

+1

제 할당 'self.moviePlayer = MP,'전체 화면으로 설정하여 '[self.moviePlayer setFullscreen : YES]'와 MPMoviePlayerController보기위한 코드가 화면에 추가된다? – iCoder

+1

@iCoder : 사용자 의견에 따라 코드를 편집했지만 여전히 운이 없습니다. –

+1

답변을 확인하십시오! – iCoder

답변

8
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

Coooool 친구, 매력처럼 작동합니다. 엄청 고마워 :) –

관련 문제