Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

How to reach metadata in version 5.1

5 replies [Last post]

In version 4 it was no problem getting the metadata, and the meta event was listed among the events in the web guide. But now I'm having problems reading the metadata in the 5.1 version.

I have added a listener to this event: MediaEvent.JWPLAYER_MEDIA_META

It seem to work but I'm unable to get the variables. What is the new syntax here?

 
There is no "new syntax".

You are confusing the plugin API with the JavaScript API.

The JavaScript API documentation for the v4 & v5 players is here:

    http://developer.longtailvideo.com/trac/wiki/Player4Api

and here:

    http://developer.longtailvideo.com/trac/wiki/Player4Events

For the 4th version of the player i had a Flash-plugin using the following in actionscript:

view.addModelListener(ModelEvent.META,metaTracker);
(in the function initializePlugin where "view" is an AbstractView added with the function call)

private function metaTracker(evt:ModelEvent):void{
filmLength = evt.data.duration;
}

This worked for alla properties in the metadata in the FLV.

This seem to work different i version 5. The following seem to be the valid way to do this but I am not getting any values.

player.addEventListener(MediaEvent.JWPLAYER_MEDIA_META, metaHandler);
(in the function initPlugin)

private function metaHandler(evt:MediaEvent):void {
length = evt.metadata.duration;
}

So this has nothing to do with javascript, but what am I doing wrong?

 
OK — my mistake — no JavaScript.

Seems to be the same case with the LINK event, where a user might click the canvas and get linked to a different location.

 
Seems to work in a v5 plugin with a v5 player:

    /** The duration of the media file. **/
    private var _length:Number = 0;

   …

      _player.addEventListener(MediaEvent.JWPLAYER_MEDIA_META,          metaHandler);

   …

    private function metaHandler(evt:MediaEvent):void
    {
      if(evt.metadata.duration != undefined)
      {
        _length = evt.metadata.duration;
      }

      ExternalInterface.call("(function(input){gid('duration').innerHTML='Duration: ' + input;})", _length);
    };

I temporarily added this to the Slideshow plugin that is used on this Test Page.

    http://willswonders.myip.org:8074/player5/Simple_Slideshow_v5.html