通过HTTP Live Streaming在iPhone上显示DVR摄像机视频

时间:2012-08-10 19:01:52

标签: iphone ios media-player http-live-streaming

我经常搜索,但无法找到编码部分。的 HTTP LIVE VIDEO STREAMING INTRO

ts file image

在此链接中我想知道如何制作索引文件和'.ts'文件以及如何在iPhone中实现。我已经完成了编码。

   -(void)replayVedio
{
         NSURL *url = [NSURL URLWithString:@"http://www.cwtmedia.se/cwtiphone/cwtvideo.mp4"];
    moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    [moviePlayer setControlStyle:MPMovieControlStyleDefault];
    moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
    CGRect frame;
    if(self.interfaceOrientation ==UIInterfaceOrientationPortrait)
        frame = CGRectMake(0, 0, 320,400);
    //    else if(self.interfaceOrientation ==UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation ==UIInterfaceOrientationLandscapeRight)
    //        frame = CGRectMake(0,0, 210, 170);
    [moviePlayer.view setFrame:frame];  // player's frame must match parent's
    [self.view addSubview: moviePlayer.view];
    [self.view bringSubviewToFront:moviePlayer.view];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:moviePlayer];


    [moviePlayer prepareToPlay];
    [moviePlayer play]; 

 }

但我不想那样。我想要这个

enter image description here

1 个答案:

答案 0 :(得分:0)

首先,你必须从苹果开发网站下载http直播流工具,这真的很难。然后它将安装一些工具,你可以使用媒体文件分段器将mp4或任何视频转换为.ts和.m3u8文件(在终端写 - > mediafilesegmenter -t 10 fileName.mp4),它将转换ts文件和m3u8文件。然后你可以在html和vlc中使用来检查你的索引文件。并查看this链接