OscarRyz
OscarRyz

Reputation: 199234

Change the playing video

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?

Upvotes: 2

Views: 525

Answers (2)

Pat
Pat

Reputation: 25675

Pretty sure it's a security problem with flash. When I try to load it locally, I get the following popup, but it works fine on my server.

alt text
(source: fullahead.org)

If you check out the Developers section in the following Adobe reference, you should be able to get it working.

Upvotes: 3

Eli Grey
Eli Grey

Reputation: 35895

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...".

Upvotes: 1

Related Questions