我有一个webview控件,并要求在YouTube中进行一些搜索。
有很多结果视频。
用户单击其中之一。
如何获得视频网址播放?
最佳答案
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemBecameCurrent:)
name:@"AVPlayerItemBecameCurrentNotification"
object:nil];
- (void)playerItemBecameCurrent:(NSNotification*)notification
{
AVPlayerItem *playerItem = [notification object];
if(playerItem == nil) return;
// Break down the AVPlayerItem to get to the path
AVURLAsset *asset = (AVURLAsset*)[playerItem asset];
NSURL *url = [asset URL]; // this is URL you need
}
关于ios - 识别在iOS的WebView中播放的youtube视频网址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38117678/