不多说直接上代码。
新建一个通知
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(notification:) name:AVPlayerItemTimeJumpedNotification object:nil];
- (void)notification:(NSNotification*)info
{
id obj = info.object;
AVPlayerItem*item = obj;
AVURLAsset*asset =item.asset;
NSLog(@"%@", asset.URL);//这里就会log出一个视频的播放地址
// [self plauerViewWithUrl:subString];
}
//下面是webview
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"视频"]]];
self.webView.allowsInlineMediaPlayback=YES;
self.webView.mediaPlaybackRequiresUserAction = NO;//打开自动播放视频
网友评论