利用AVFoundation播放视频
by 伍雪颖
#import
<AVFoundation/AVFoundation.h>
NSURL *URL = [[NSBundle
mainBundle]
URLForResource:@"13_cn"
withExtension:@"mp4"];
AVPlayer *player = [AVPlayer
playerWithURL:URL];
AVPlayerLayer *playerLayer = [AVPlayerLayer
playerLayerWithPlayer:player];
playerLayer.frame =
self.view.bounds;
[self.view.layer
addSublayer:playerLayer];
[player
play];
时间: 2024-11-09 05:03:58