views:

181

answers:

2

Hi.

I'm trying the following code http://code.google.com/apis/ajax/playground/#change_the_playing_video

It works well when runned from the playground page. But if I create a new localfile with the source code provided as sample I get the following error:

ytplayer is not defined

at line 40:

if(ytplayer) {
      ytplayer.loadVideoById(videoID);
}

It looks like for some reason I don't get access to some part of the javascript needed by the sample.

Is it just me? Or sample code don't run outside the playground page?

+3  A: 
Pat
+1  A: 

This has to do with same-domain restrictions in Flash. Local files trying to access resources on the internet counts as "cross-domain" access. To whitelist your local file, add it's location to the global security settings. Click on "Edit locations..." and then "Add location...".

Eli Grey
That's the oddest security settings manager I have ever seen. Ultra counter intuitive. It took me about 10 minutes to realize "That was not a picture"... and other 5 to figure out what to change. Terrible terrible. Actually I think Pat answer was in the same way, but I just didn't get it. Thanks for the link. Could you complement the info with some screenshots? ( I don't know why but I feel I'll forget the answer in a couple of weeks ) Thanks!
OscarRyz
I have added this to the Worst UI ever: http://stackoverflow.com/questions/238177/worst-ui-youve-ever-used/1338855#1338855
OscarRyz