将点播视频从 IIS7 流式传输到 iOS 设备

发布于 2024-10-02 06:48:05 字数 2346 浏览 2 评论 0原文

我首先阅读了 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];
    }

任何人都可以提供解释或可能的解决方案吗?

I started with an article from Scott Hanselman about how to stream video to an iPhone using the IIS 7 Smooth Streaming and the Transform Manager. Fantastic article and everything works 100% as advertised.

http://www.hanselman.com/blog/CommentView.aspx?guid=86968CD5-FEEB-47F2-B02E-1EB4FA556379

I am able to use the browser on an iPad and go to my companies website and see a video play in the browser, embedded into an HTML page using the following 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> 

The problem I am having is when I try to take the exact same URL "http://name-of-video-here.ism/manifest(format=m3u8-aapl).m3u8" and try to play it using the "CustomMPMovie" or "MPMoviePlayerController" from within a custom application running on the same iPad it doesn't work.

Objective-C that plays the video

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

Can anyone offer an explanation or a possible solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北城挽邺 2024-10-09 06:48:05

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

As it turns out this is 100% dump developer error. The movie source type needed to get switched to "MPMovieSourceTypeStreaming" and after we did that everything started working again. The IIS Smooth Streaming and Transform Manager is working in production and we are very happy with the output. The built in Silverlight support is awesome too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文