6

I was curious if there was a way of telling if audio is coming from a specific WKWebView similar to the way you can find the tab playing audio in Chrome and Safari?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
timothy5216
  • 280
  • 5
  • 18
  • You can check the `UIWebView` solution, maybe it works for `WKWebView` too, e.g. http://stackoverflow.com/questions/33240647/how-to-detect-the-playing-state-of-the-audio-in-uiwebview-in-ios – Sulthan Mar 25 '16 at 17:25

1 Answers1

1

In the WKWebView's delegate, after webview loading finished, execute javascript that addEventListener to audio and video tag with event play, pause, ended. Then check the playback state for purpose.

Elf Sundae
  • 1,575
  • 16
  • 23
  • Can you elaborate how, specifically for macos? – slashlos Apr 30 '18 at 11:35
  • Can you explain how can do this with javascript please see and give me any suggestion https://stackoverflow.com/questions/55377677/how-to-detect-avplayer-and-get-url-of-current-video-from-wkwebview – Virani Vivek Apr 04 '19 at 07:02