我从Scott Hanselman关于如何使用IIS 7平滑流媒体和转换管理器将视频流到iPhone的文章开始。很好的文章和一切工作100%的广告。
http://www.hanselman.com/blog/CommentView.aspx?guid=86968CD5-FEEB-47F2-B02E-1EB4FA556379
我可以在iPad上使用浏览器,进入我的公司网站,在浏览器中观看视频播放,使用下面的HTML嵌入到HTML页面中。
<html>
<head>
<title>iPhone page</title>
</head>
<body>
<h1>Encoded stream</h1>
<video width="640"
height="480"
src="http://name-of-video-here.ism/manifest(format=m3u8-aapl).m3u8"
autoplay="true"
controls="true" >Live</video>
</body>
</html>
我遇到的问题是,当我尝试使用完全相同的URL“http://name of video here.ism/manifest(format=m3u8 aapl.m3u8”并尝试使用“CustomMPMovie”或“MPMoviePlayerController”在同一台iPad上运行的自定义应用程序中播放时,它不起作用。
播放视频的Objective-C
NSURL *theURL = [NSURL URLWithString:[item url]];
if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2)
{
NSLog(@"> 3.2");
CustomMPMovie *mp = [[CustomMPMovie alloc] initWithContentURL:theURL];
if (mp)
{
mp.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[self.navigationController presentMoviePlayerViewControllerAnimated:mp];
[mp shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
[mp.moviePlayer play];
[mp release];
}
}
else if ([[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2)
{
NSLog(@"< 3.2");
MPMoviePlayerController* theMovie = [[MPMoviePlayerController alloc] initWithContentURL: theURL];
theMovie.scalingMode = MPMovieScalingModeAspectFill;
// Register for the playback finished notification
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(myMovieFinishedCallback:)
name: MPMoviePlayerPlaybackDidFinishNotification
object: theMovie];
// Movie playback is asynchronous, so this method returns immediately.
[theMovie play];
}
有人能给我一个解释或者一个可能的解决方案吗?