0 Replies Latest reply on Dec 30, 2009 2:28 PM by willm8655

    Chromeless Youtube player help needed.

    willm8655

      Hi, i've been trying to get the youtube chromeless player to work for the last day now, but am not being successful.

       

      I've been trying to use the example code located here: http://code.google.com/apis/youtube/flash_api_reference.html

       

      So my source file looks like this:

       

       

      <?xml version="1.0" encoding="utf-8"?>

       

      <mx:Application

       

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

       

      <mx:Script>

      <![CDATA[

       

      // This will hold the API player instance once it is initialized.

       

      var player:Object;

       

       

      var loader:Loader = new Loader();

      loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);

      loader.load(

      new URLRequest("http://www.youtube.com/apiplayer?version=3"));

       

       

      function onLoaderInit(event:Event):void {

      addChild(loader);

      loader.content.addEventListener(

      "onReady", onPlayerReady);

      loader.content.addEventListener(

      "onError", onPlayerError);

      loader.content.addEventListener(

      "onStateChange", onPlayerStateChange);

      loader.content.addEventListener(

      "onPlaybackQualityChange",

      onVideoPlaybackQualityChange);

      }

       

       

      function onPlayerReady(event:Event):void {

       

      // Event.data contains the event parameter, which is the Player API ID

       

      trace("player ready:", Object(event).data);

       

       

      // Once this event has been dispatched by the player, we can use

       

      // cueVideoById, loadVideoById, cueVideoByUrl and loadVideoByUrl

       

      // to load a particular YouTube video.

      player = loader.content;

      }

       

       

      function onPlayerError(event:Event):void {

       

      // Event.data contains the event parameter, which is the error code

       

      trace("player error:", Object(event).data);

      }

       

       

      function onPlayerStateChange(event:Event):void {

       

      // Event.data contains the event parameter, which is the new player state

       

      trace("player state:", Object(event).data);

      }

       

       

      function onVideoPlaybackQualityChange(event:Event):void {

       

      // Event.data contains the event parameter, which is the new video quality

       

      trace("video quality:", Object(event).data);

      }

       

      ]]>

       

      </mx:Script>

      </mx:Application>

       

       

       

      However i get the error: "Access of undefined property loader." although it is defined in the line above?

       

      Has anyone had any success getting the chromeless player working?

       

      Any help would be much appreciated.

       

      Thanks

      Will