我有一个网址http://stream.alayam.com/alayam/alayam/playlist.m3u8 http://stream.alayam.com/alayam/alayam/playlist.m3u8想在iPhone上播放,m3u8格式,我已经成功获得了声音,但是电影没有来。我使用过MPMEDIAPLAYER框架和其他东西。
我在新答案中给你答案,因为代码将更具可读性。
我只是从 Apple 网站下载 MPMovies Controller 示例,然后添加您的链接http://
In NSURL
我传递链接http://stream.alayam.com/alayam/alayam/playlist.m3u8
不是这个stream.alayam.com/alayam/alayam/playlist.m3u8
而且效果很好。
-(void)initAndPlayMovie:(NSURL *)movieURL
{
// Initialize a movie player object with the specified URL
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
if (mp)
{
// save the movie player object
self.moviePlayer = mp;
[mp release];
// Apply the user specified settings to the movie player object
[self setMoviePlayerUserSettings];
// Play the movie!
[self.moviePlayer play];
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)