4

i have a wkwebview that goes into youtube and I would like to click on a video without it automatically throwing me into the video player.

I tried stopping this in 3 different ways

  1. using the config.requiresUserActionForMediaPlayback = true
  2. in the decidePolicyForNavigationAction delegate function i check for the presence of a youtube video and set decisionHandler(WKNavigationActionPolicy.Cancel)
  3. i also added a webView.stopLoading() to the stuff i did in #2

despite doing that, clicking on the link still triggers the video to automatically start playing.

i'm out of ideas; any thoughts?

i know i could try injecting some javascript but that seems like a last resort to me.

stanley
  • 1,113
  • 1
  • 12
  • 26

0 Answers0