2016-06-30 8 views

答えて

0
[[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 
} 
0

あなただけのURLを取得したい場合は、このコードを試してみてください。

NSStringの* CURRENTURL = [WebViewのstringByEvaluatingJavaScriptFromString: "window.locationの" @]を。

しかし、あなたはすべてのイベントを取得したい場合は、単にWebViewのデリゲートメソッドを使用します。

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { 
     NSString *URLString = [[request URL] absoluteString]; 
     //now you have the url; 
     return YES; 
    } 
関連する問題