【发布时间】:2013-07-24 10:47:44
【问题描述】:
我正在使用此代码使用 avplayer 播放视频文件,我该如何停止它
[videoView setHidden:NO];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path2 = [documentsDirectory stringByAppendingPathComponent:saveFileName];
NSURL *url1 = [[NSURL alloc] initFileURLWithPath: path2];
videoPlayer = [AVPlayer playerWithURL:url1] ;
self.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:videoPlayer];
//[self willAnimateRotationToInterfaceOrientation];
avPlayerLayer.frame = videoView.bounds;
[self.videoView.layer addSublayer: avPlayerLayer];
[self.videoPlayer play];
我试过了,不行
//[self.videoPlayer release];
【问题讨论】:
标签: objective-c avfoundation avplayer