Go
Not registered? Sign up!

view.playlist object access returns only 'title'

Google Translate
6 posts | return to the Plugins forum | get the rss feed for this thread

Jun. 26, 2009Peter Mee

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>

Jun. 26, 2009lost

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'];

Jun. 26, 2009Peter Mee

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-4-3)

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

My query stands.

Peter

Jun. 26, 2009Peter Mee

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

Jun. 26, 2009lost

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!

Jun. 29, 2009Zachary Ozer

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/

Add a reaction

You can also return to the category or try this search for related threads.


 

Search the Forums

Go

Support

Support Here are some helpful links to learn more about the JW Player™:

Monetize Your Video

Monetize Your Video Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!

Why Buy a License?

Why Buy a License? If you don’t buy a commercial license, you cannot use a JW Player™ on (i) a site that has ads; (ii) a corporate site; or a (iii) CMS. Our licenses are very inexpensive, so what are you waiting for? Buy a license today.