Node WebKit and YouTube: chrome is not defined

空扰寡人 提交于 2019-12-06 00:27:08

It looks like this is related to the Chromecast Chrome plugin. I'm assuming you have

"webkit": {
    "plugin": true
}

in your manifest for flash, so the Chromecast plugin is also getting loaded. Then when it tries to interact with the YouTube player it fails.

Try removing the Chromecast plugin to see if this resolves the issue. if so then your options are:

  1. Remove the Chromecast plugin, there isn't a way to only load specific plugins in node-webkit that I'm aware of. This may not be the best solution especially if you are distributing your app.

  2. Use another method to load the YouTube video. I use the JavaScript Player API and I don't have any issues. You can find my example here:

    https://gist.github.com/octalmage/03a054bb27d597a9f095

    And the API reference:

    https://developers.google.com/youtube/js_api_reference#Embedding

  3. Load your HTML over a local webserver. This error seems to be caused by using the file:// protocol so loading your HTML using a local webserver might resolve the issue. I personally use this with method 2 to get past the restricted playback errors (https://cloudup.com/cUXiDgrYBOm) but I'm not sure if it will fix your issue alone.

Edit: I just realized I get this error with webkit plugin set to false, try setting it to true! The video works for me without any changes when webkit plugin is enabled. The error does flash before the video plays though.

https://cloudup.com/c6VyHbIyyez

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!