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

Forums

/

view.playlist object access returns only 'title'

5 replies [Last post]

I have an URGENT problem with the following code. All help appreciated.

public function initializePlugin(vie:AbstractView):void {
view = vie;
view.addControllerListener(ControllerEvent.ITEM, itemHandler);

};

/** Function stores playlist item in variable **/
private function itemHandler(evt:ControllerEvent):void {
curPlayItm = evt.data.index;

//Populate Text Field
var main = view.playlist[curPlayItm]['title'];
var sub = view.playlist[curPlayItm]['tags'];

}

I'm storing the index in a variable and then attempting to access properties of the playlist. 'title' always returns perfectly but attempting to retrieve any ofther playlist property fails (null).

Here;'s my playlist xml;

<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<tracklist>
<track>
<title>FINEOS, A Platform for Business Growth</title>
<location>./content/FINEOS_Paddy_Flynn.flv</location>
<image>./content/FINEOS_Paddy_Flynn.jpg</image>
<duration>4:50</duration>
<tags>Paddy Flynn CIO, Friends First</tags>
</track>

<track>
<title>Helping CommInsure go from Good to Great</title>
<location>./content/FINEOS_Julie_Vincent.flv</location>
<image>./content/FINEOS_Julie_Vincent.jpg</image>
<duration>5:43</duration>
<tags>Julie Vincent, Head of Life Insurance Services, CommInsure</tags>
</track>

</tracklist>
</playlist>

Unfortunately, I'm not a Flash developer, so I can't be of much help to you.

The documentation here: http://code.longtailvideo.com/trac/wiki/FlashApi#Plugins1 shows it being done like this:

var title = view.getPlaylist()[1]['title'];

Thanks for the response lost.

However, according to a post in this thread (http://www.longtailvideo.com/support/forum/Bug-Reports/16272/getPlaylist-doesn-t-work-in-AS-Player-v...)

getPlayList() is deprecated. The documentation needs to be updated, apparently.

My query stands.

Peter

Solved it

By adding this to my function i was able to dump the properties and values in the playlist[n] object

var obj:Object = view.playlist[curPlayItm];
var sub:String;
for (var i:* in obj) {sub=sub+i+" :: "+obj[i];}

it gave me this:

nullimage :: ./content/FINEOS_Paddy_Flynn.jpgtype :: videoduration :: 290title :: FINEOS, A Platform for Business Growthdescription :: Paddy Flynn CIO, Friends Firstfile :: ./content/FINEOS_Paddy_Flynn.flvstart :: 0

So it appears that the 'tags' node in the playlist.xml file is mapped to the 'description' property playlist object.

Who knew?

I certainly would not have picked it up from this table;

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

I hope this helps someone in the future.

Peter

Hmmmm.....

That's interesting. Yeah, it seems the docs sometimes trail the releases by a bit.

Even though I work in JavaScript, I sometimes have to look through the ActionScript to see what's going on.

Anyway, glad to see you got it working.

And, thanks a lot for posting your solution here. I'm sure that it will save other devs a lot of hair!

The function has not been deprecated.

It looks like you're requesting the playlist before it's actually loaded. A few things might happen:

* javascript returns an error if the playlist is loaded before either the SWF is instantiated or the javascript API is inited. Can be worked around by waiting for the playerReady call.
* javascript returns an empty playlist if the player is ready, but the playlist (xml file?) isn't loaded yet. Can be worked around by subscribing to the PLAYLIST event.

This tutorial @ shows a best practice for reading the playlist on load:

http://www.bitsontherun.com/tutorials/creating-playlists-javascript/