2

I used UIWebView to get the video url embedded in web page using AVPlayerItemBecameCurrentNotification. Due to memory pressure issue I used WKWebView instead of UIWebView, which is far better memory efficient than UIWebView. But I did not get a way to fetch the url of embedded video. I am still searching on this issue and found some similar questions in stack overflow, but all questions are unanswered.

Please suggest a method to get the embedded video url in web page using WKWebView

Aswin
  • 91
  • 7
  • can show me how did you get links from `AVPlayerItemBecameCurrentNotification ` I have this issue :https://stackoverflow.com/questions/44988987/get-video-url-from-avplayer-in-uiwebview – iOS.Lover Jul 08 '17 at 19:32

1 Answers1

5

Atlast I found a solution to get the video embedded in the web page using WKWebVIew. We can add javascript code to get the url. The video url will be available only after loading the selected video.

[wkWebView evaluateJavaScript:@"document.querySelector('video').currentSrc;" completionHandler:^(id result, NSError *error) {
        // result will contain the video url
 }];
Aswin
  • 91
  • 7