我想通过AVPlayer
播放我正在网上下载的视频:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *fileName = [NSString stringWithFormat:@"%@.mp4", [[paths objectAtIndex:0] stringByAppendingPathComponent:@"1"]];
audioPlayer = [[AVPlayer alloc]initWithURL:[NSURL fileURLWithPath:fileName]];
avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:audioPlayer];
[avPlayerLayer setFrame:self.view.bounds];
[audioPlayer play];
[[self.view layer] addSublayer:avPlayerLayer];
我完成了文件下载50%后的操作。它开始播放,在50%的播放过程中它什么都没玩。
我想知道是否有办法追加已经在AVPlayer
播放的文件。
答案 0 :(得分:0)
[player seekToTime:CMTimeMake(0, 1)];
[player pause];