Node WebKit and YouTube: chrome is undefined

I am developing an application for Android

, iOS

, Mac OS

and Windows

via PhoneGap

and Node-WebKit

. This app has embedded videos youtube

.

These youtube

videos work fine in my application Mobile

( Android

/ iPhone

) using PhoneGap

, but if I test it on my own Mac

(by creating an application using grunt node-webkit builder

) I get the following error:

Unprepared ReferenceError: chrome not defined
www-embed-player.js: 184

I tried to check this line and there is code like:

chrome.cast.requestSession(v(this.Lc,this)

      

I am embedding video using an iframe:

<iframe src="http://www.youtube.com/embed/rjKRQYmi1Lk" frameborder="0" allowfullscreen="" ></iframe>

      

Does anyone know how I can solve it?

Thank!

+3


source to share


1 answer


It looks like it has something to do with the Chrome Chromecast plugin. I assume you have

"webkit": {
    "plugin": true
}

      

in your manifest for flash, so the chromecast plugin is loaded as well. Then when he tries to interact with the YouTube player, he fails.

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



  • Uninstall the Chromecast plugin, there is no way to download specific plugins in node-webkit that I am aware of. This may not be the best solution, especially if you are distributing your application.

  • Use a different method to upload YouTube videos. I am using the JavaScript Player API and I have no problem. You can find my example here:

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

    And the API link:

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

  • Download HTML via local web server. This error appears to be caused by the use of the file: // protocol, so uploading the HTML using a local web server might fix the problem. I personally use this with way 2 to overcome limited replay errors ( https://cloudup.com/cUXiDgrYBOm ), but I'm not sure if it will fix your problem alone.

Edit: I just realized I was getting this error with the webkit plugin installed set to false, try setting it to true! The video works for me without any change when the webkit plugin is enabled. An error occurred before playing the video.

https://cloudup.com/c6VyHbIyyez

+1


source







All Articles