问题
I have a URL (http://ms1.clickhere2.com:1935/live/power98/playlist.m3u8) and wanted to play in iPhone, with m3u8 format, would somebody help on this, I have used MPMEDIAPLAYER framework and other things.
回答1:
Try like this:
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];
}
来源:https://stackoverflow.com/questions/9922700/how-to-play-m3u8-audio-file