Black Screen For Video play url come from server Side

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

  • [self.view addSubview:self.moviePlayer.view]; add this before

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

    these line.

    FYI. And this player can play in simulator.

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

    上一篇: 使用适用于录制文件的AudioUnit过滤器录制麦克风输入

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