javascript - youtube iframe api not working in firefox with backbone -


So I am trying to implement the YouTube API in the backbone code.

I see the API one and try to run everything from there

It does a great job in Chrome but is running in Firefox, to trigger an event that triggers It seems when the YouTube API is not loading. If it is related to the related context, then this warning will run in Chrome, but not in Firefox.

Has anyone seen anyone like this before?

Use the spinebone 0.9 and the YouTube iframe API

Live example:

Related code

  App.Views. 'You' 'Wmode': 'transparent', 'original': 'http: //www.youtube.com', 'capableJP': 1, 'autoplay': 0, 'control': 1, 'iv_load_policy': 3, 'Shinfu ', 0:' Relay ': 0,' AcceptableSluscreen ': 1,' Permission Spontaneous': 'Yes'}}, Start: Function (Option) {// Force Itubeplay Event To run this password. ('Youtubeplay', this.play, this); // To stop this method, compel youtubestop.bind ('youtubeStop', this.stop, this); // Extension of this The options are universally accessible to this. $ = $ .extend (True, Default, Option); This.render ();}, Render: Function () {// A new YouTube Player vs. View = this; Console.log ("This is run by Firefox"); This.ytplayer = new window.YT.Player ('ytplayer', {'events': {' onReady ': view.onPlayerReady,' on error ': View.onError,' onStateChange ': view.onPlayerStateChange}}); This return; }, // When the YouTube player is ready to run PlayerReady: function (e) {console.log ('This function is run in Firefox'); // Start the first video App.videos.youtubeready (); }});   

outside the reader code because the YouTube API player needs to declare the global

  var tag = document.createElement ('script'); Tag src = "https://www.youtube.com/iframe_api"; On firstScriptTag = document.getElementsByTagName (such as script ') [0]; FirstScriptTag.parentNode.insertBefore (tag, firstScriptTag); YouTube IFrame on Function () {app. YouTubePlayer = new app View. The full code can be found here  

Div>

I think I got an answer to this problem. I applied it and it really works great now here its essence Is:

Firefox has two different implementations of the IFrame: the first implementation of the first launch of the browser is the Load. Second On Load is after event. What does this mean for the Backbone / Console or other event-driven Javascript application framework, which works after the Load event, will not work to add the IFrame Dynamically on your page to Youtube IFrame API.

I found that the solution is also located in the YT IFrame API documentation, but you will not know it.

See the section after JF, create the iframe tag itself about? It's okay! So you need iframe in your page when the page is sent from the server (i.e.: your index.html) or whatever main file you are using.

In your case, it seems that you have got a backbone / merient app, so this solution should work well for you.

  & lt; Iframe id = "player" type = "text / html" width = "1" height = "1" src = "http://www.youtube.com/embed/?enablejsapi=1&origin=http://example .com "frameborder =" 0 "& gt; & Lt; / Iframe & gt;   

The above code in your main document will be referenced from some other backbone app.

Good luck, if you need more help, just answer it.

Jeff: FWW- This iframe / firefox problem is present since at least 2005 (I found the date of the vague post). You might want to note this in the dynamic format of the dynamic single page JavaScript application developers, as it is not easy to debug.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -