[Playlist] XSPF for haXe

Bjorn Wijers bjorn at simuze.nl
Mon Apr 28 14:23:58 UTC 2008


Hi Tong,

Thanks for your advice.

Sadly I did not get it to work yet. I'm still very much learning HaXe,
but if you could help me out once more I'd very grateful.

I can get the xml loaded using your example code, yet when I try to
parse it using the xspf parser I get a: "(uncaught exception): XSPF
invalid: undefined"

This is my code:

class Player{
  public function new(){
    var src : Xml;
    var http = new
haxe.Http("http://localhost/simuze-mockup/player/test.xspf");
  http.onData = function(d) {
          src = Xml.parse(d);
          trace(src);
  }
  http.request(false);
  var xspf = format.XSPF.parse( src );
  trace(xspf);
}
  static var r : Player;

  static function main() {
    r = new Player();
  }
}

My hxml file:

-lib xspf
-swf ../builds/player.swf
-swf-lib ../builds/testlib.swf
-main Player

My configuration:
-Ubuntu Linux 7.10 (Gutsy Gibbon)
-Haxe Compiler 1.18
-XSPF 0.9.1
-validated XSPF file, which can be downloaded here:
http://www.simuze.nl/live/media/playlist/users/bjorn/Mijn_eerste_playlist.xspf

All the best,

grtz
BjornW

Stichting Open Media
simuze.nl | netcultuur.nl | open-media.nl
Concordiastraat 68-126
3551 EM Utrecht
+31 (0)30 - 2444101
http://www.open-media.nl
info at open-media.nl


tong wrote:
> On Thu, 2008-04-17 at 13:33 +0200, Bjorn Wijers wrote:
>> Great!
>>
>> I've just started using your lib, but I have some issues understanding
>> how to use it. Specifically how to load an external playlist?
> 
> 
> this depends on your haxe-target ( flash, js, neko ).
> for example:
> 
> --------------flash:
> 
> var src : Xml;
> var http = new haxe.Http( URLTOXSPFFILE );
> http.onData = function(d) {
>         src = Xml.parse(d);
>         trace(src);
> }
> http.request(false);
> 
> 
> -------------neko:
> 
> var src : Xml;
> var file = neko.io.File.getContent( URLTOXSPFFILE );
> src = Xml.parse( file );
> trace( src );
> 
> 
> --------------
> you can also use the platform specific api to load files:
> for flash9:
> 
> var loader = new URLLoader();
> loader.addEventListener( Event.COMPLETE, function(e) {
>         trace(e.target.data);
> });
> loader.load( new URLRequest(URLTOXSPFFILE) );
> 
> 
> -------------
> after loading/parsing xml:
> var xspf = format.XSPF.parse( src );
> ...
> 
> 
> greets.tong



More information about the Playlist mailing list