javascript - YouTube API function calls not working when used in Chrome extension -
javascript - YouTube API function calls not working when used in Chrome extension -
we're trying create chrome extension uses youtube api. video displays, none of api functions (seekto, getcurrenttime, etc, etc) work. console shows 'undefined not function' errors of functions. , onready isn't firing, either. here's manifest.json:
{ "manifest_version": 2, "name": "asyncyoutube", "description": "this extension provides improved accessbility options youtube subtitles low vision.", "version": "0.1", "permissions": [ "tabs", "<all_urls>" ], "content_security_policy": "script-src 'self' https://www.youtube.com/ https://s.ytimg.com/; object-src 'self'", "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" } }
and onyoutubeiframeapiready implementation is:
// called when youtube api loaded function onyoutubeiframeapiready() { 'use strict'; player = new yt.player('player', { height: '390', // height of player width: '640', // width of player videoid: vid, // youtube video id enablejsapi: 1, // enables javascript api events: { 'onready': onplayerready // gets called when player ready } }); }
i've done research this, , haven't turned solutions. did, however, find extension, https://github.com/justinforce/popout_for_youtube, has exact same problem (the console displays 'undefined not function' errors every phone call youtube api functions), led me suspect problem has arisen within lastly year.
our code works when it's webpage -- on chrome , all. chrome extension, breaks.
hopefully can help out -- or @ to the lowest degree confirm it's bug!
javascript google-chrome google-chrome-extension youtube youtube-javascript-api
Comments
Post a Comment