Как воспроизвести аудиофайл m3u8? - PullRequest
2 голосов
/ 29 марта 2012

У меня есть URL (http://ms1.clickhere2.com:1935/live/power98/playlist.m3u8)), и я хотел бы поиграть в iPhone, в формате m3u8, кто-нибудь поможет с этим, я использовал фреймворк MPMEDIAPLAYER и другие вещи.

1 Ответ

4 голосов
/ 29 марта 2012

Попробуй так:

NSString *path =[[NSString alloc] initWithString:@"http://stream.alayam.com/alayam/alayam/playlist.m3u8"];



NSURL *audioUrl=[NSURL URLWithString:path];

MPMoviePlayerController *player =  [[MPMoviePlayerController alloc] initWithContentURL:audioUrl];
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(loadStateDidChange:)                                                 name:MPMoviePlayerLoadStateDidChangeNotification 
                                           object:player];
if ([player respondsToSelector:@selector(loadState)]) 
{
    [player setControlStyle:MPMovieControlModeVolumeOnly];
    [player setFullscreen:YES];
    [player prepareToPlay];
}   
...