开发者

Streaming On-Demand Video from IIS7 to iOS Devices

开发者 https://www.devze.com 2023-01-24 14:10 出处:网络
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 adverti

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 t开发者_JAVA技巧he 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号