无法在AVPlayer中播放RTMP网址?

时间:2018-06-08 09:26:55

标签: ios objective-c iphone rtmp

- (void)playMethod {


 NSURL *url = [[NSURL alloc] initWithString:@"rtmp://54.206.31.70:1935/CVIEW_alpha/24"];


    player = [AVPlayer playerWithURL:url];
    controller = [[AVPlayerViewController alloc] init];
    [self addChildViewController:controller];
    [self.view addSubview:controller.view];

    //to rotate to the landscape on click of play button
    [[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeLeft) forKey:@"orientation"];
    [UINavigationController attemptRotationToDeviceOrientation];

    //to open the view
    controller.view.frame = CGRectMake(0,0,667,375);
    controller.player = player;
    controller.showsPlaybackControls = YES;

    // to add the back button on player
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [button1 addTarget:self
                action:@selector(backMethod)
      forControlEvents:UIControlEventTouchUpInside];
    [button1 setTitle:@"Back" forState:UIControlStateNormal];
    [button1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button1.frame = CGRectMake(50.0, CGRectGetMinY(controller.view.frame)+10, 160.0, 40.0);
    button1.tag = 1001;
    [self.view addSubview:button1];
    [controller.view  bringSubviewToFront:button1];
    [player pause];
    [player play];
}

我正在尝试在AVPlayer中播放上述网址并收到以下错误。

  

2018-06-08 14:55:00.326842 + 0530 vedio [14773:4486922] NSURLConnection完成错误 - 代码-1002   2018-06-08 14:55:00.605227 + 0530 vedio [14773:4485935] []&lt;&lt;&lt;&lt; AVOutputDeviceDiscoverySession(FigRouteDiscoverer)&gt;&gt;&gt;&gt; - [AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]:将设备发现模式设置为DiscoveryMode_None(client:vedio)   2018-06-08 14:55:00.652598 + 0530 vedio [14773:4485935] []&lt;&lt;&lt;&lt; AVOutputDeviceDiscoverySession(FigRouteDiscoverer)&gt;&gt;&gt;&gt; - [AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl outputDeviceDiscoverySessionDidChangeDiscoveryMode:]:将设备发现模式设置为DiscoveryMode_Presence(client:vedio)   2018-06-08 14:55:01.013628 + 0530 vedio [14773:4485935] [App]如果我们在真正的预提交处理程序中,由于CA限制,我们实际上无法添加任何新的围栏   2018-06-08 14:55:01.013766 + 0530 vedio [14773:4485935] [应用]如果我们在真正的预提交处理程序中,由于CA限制,我们实际上无法添加任何新的围栏< / p>

1 个答案:

答案 0 :(得分:1)

AVPlayer不支持rtmp。您必须使用其他播放器或协议。