0
下面的代碼是不工作AVPlayerViewController沒有顯示視頻
AVPlayerViewController *playerViewController = [[AVPlayerViewController alloc] init];
NSURL *url = [NSURL URLWithString:@"http://54.254.248.1/app/webroot/uploads/question_files/2017.04.20.13.43.45video.mp4"];
AVURLAsset *asset = [AVURLAsset assetWithURL: url];
AVPlayerItem *item = [AVPlayerItem playerItemWithAsset: asset];
AVPlayer * player = [[AVPlayer alloc] initWithPlayerItem: item];
playerViewController.player = player;
[playerViewController.view setFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.width)];
playerViewController.showsPlaybackControls = YES;
[self.view addSubview:playerViewController.view];
[player play];
你的代碼仍然是不工作 –
你有編譯和測試這個代碼嗎? // clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' –
一定的工作,但我不使用你的網址,我用'的https替換您的網址請用我的網址朋友 – liangju