代码之家  ›  专栏  ›  技术社区  ›  Ryan Pedersen

从IIS7到iOS设备的流式点播视频

  •  0
  • Ryan Pedersen  · 技术社区  · 15 年前

    我从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];
        }
    

    有人能给我一个解释或者一个可能的解决方案吗?

    1 回复  |  直到 15 年前
        1
  •  1
  •   Ryan Pedersen    15 年前

    事实证明这是100%转储开发人员错误。电影源类型需要切换到“MPMovieSourceTypeStreaming”,在我们完成之后,一切都重新开始工作。IIS平滑流和转换管理器正在生产中工作,我们对输出非常满意。内置的Silverlight支持也非常棒。