Kor;1093354 wrote:You can't do that in that way. You should load the API codes and the Flash application in your document, as external elements. Now you can call the API method onload, because both the API and the movie are within your document.
Thanks for your suggestion. Actually I tried to load the video and used the API functions, and they worked perfectly.
But the problem is that when I do it in chrome extension, the page is already there. I do not need to load any video or API functions, because the extension will be triggered when the youtube web pages are opened. So what have to do is invoke a youtube API function setPlaybackQuality(hd720'). I put this in the js file of the extension and I fond that this API function is not defined at all.
And I get a tip from another guy tells that the js file lives in a different world of the page, which means I can not call the function of the API from the page I opened. That's why I tried to use the locate function and call the API function when the page is loaded.
That guy suggested me to try to take action on the DOM of the youtube page, which is like:
location.href="javascript:player = document.getElementById('movie_player');player.setPlaybackQuality('hd720');void(0)";
And I found that setPlaybackQuality still not defined in this section, so it did not work out neither. 
So bascly what I need now is to figure out how to call this API function inside the js file(this file is in a different world of the youtube page).