DEV Community

loading...

Newer VSCode / Electron cannot embed YouTube, and probably cannot play video/audio.

patarapolw profile image Pacharapol Withayasakpunt ・1 min read

Webview embedding of YouTube video worked in May 2019, but no longer does #82012

  • VSCode Version: 1.38.1
  • OS Version: Windows 10

I have an extension that, at least as recently as May 2019, was able to embed YouTube videos in a webview using this code:

<iframe width="480" height="270" class="video" src="https://www.youtube.com/embed/S-thTTqefls" frameborder="0"></iframe>

It used to show a thumbnail, but now shows an error about not recognizing the video format. I did see a similar issue, #54097, attributed to VSCode's Electron build not having ffmpeg, but that issue was posted in July 2018, almost a year before I released my extension with functional embedding. I just wanted to confirm if this is the same underlying issue or if something else changed in VSCode? (If there wasn't a change on the VSCode side, then I suppose YouTube must no longer be offering a format that VSCode supports.)

You can see an example of how it used to look on the extension's page in the animated demo. Here's a still:

image

But now it just shows this:

image

Does this issue occur when all extensions are disabled?: Yes (except for running my extension in VSCode debugger)

Solution? I know one - use Neutralino / native WebView; or Lorca / Chrome Dev Protocols.

Discussion

pic
Editor guide