黑屏对于视频播放网址来自服务器端

  • NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString * documentsDirectory = [paths objectAtIndex:0]; NSString * pathVideo = [documentsDirectory stringByAppendingPathComponent:@“MyVideo.mp4”];
    NSURL * movieURL = [NSURL fileURLWithPath:pathVideo]; self.movi​​ePlayer = [[MPMoviePlayerController alloc] init]; [self.movi​​ePlayer setShouldAutoplay:YES]; [self.movi​​ePlayer setContentURL:movieURL.absoluteURL]; [self.movi​​ePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.movi​​ePlayer setControlStyle:MPMovieControlModeDefault]; [self.movi​​ePlayer setFullscreen:NO]; [self.movi​​ePlayer setScalingMode:MPMovieScalingModeNone]; self.movi​​ePlayer.view.frame = CGRectMake(40,40,240,350); [self.view addSubview:self.movi​​ePlayer.view]; [self.movi​​ePlayer prepareToPlay]; [self.movi​​ePlayer play];

  • [self.view addSubview:self.movi​​ePlayer.view]; 之前添加此

    [self.moviePlayer prepareToPlay];
    [self.moviePlayer play];
    

    这些线。

    仅供参考。 这个玩家可以在模拟器中玩。

    链接地址: http://www.djcxy.com/p/78151.html

    上一篇: Black Screen For Video play url come from server Side

    下一篇: AVCaptureSession and background audio iOS 7