PDA

View Full Version : loading music from remote server


whisperstorm
11-06-2003, 12:11 AM
I'm trying to create some code which allows me via a data xml file to set the path to an mp3 file on the net. when this tag's ondata is called, I want to fetch the url of this mp3 file and have it start playing immediately. But for some reason when I do setSource(), passing for example "http://something.com/foo.mp3" doesnt work.

I notice now that I also am not able to dynamically set images either - up to now i've been getting them via relative url.

The end goal is to get my little tinyworld widget to be able to load custom images as "tiles" as well as to load a custom mp3 as background music.

So I guess my question is how do I via data do the equiv of

<view resource="http://www.laszlosystems.com/images/smiley.gif">


only also for music.. and have it play the remote file...

antun
11-06-2003, 09:43 AM
Are you sure there's nothing wrong with your server? I'm using 1.0.2, and I can set images fine using setSource(), both relatively, and absolutely.

Your example didn't work because http://www.laszlosystems.com/images/smiley.gif had been deleted. However I've put it back now.

-Antun

antun
11-06-2003, 09:46 AM
Sorry, I didn't mean "your example didn't work". What I meant was that my test case (based on what you described) didn't work. Here's my test case:


<canvas debug="true">
<simplelayout axis="y" spacing="5" />

<view name="foo" />

<button>
<method event="onclick">
foo.setSource( 'http://www.laszlosystems.com/images/smiley.gif' );
</method>
</button>
</canvas>


-Antun

whisperstorm
11-06-2003, 10:15 AM
I'm using 1.0.1 - I'll try 1.0.2 and let you know.

whisperstorm
11-06-2003, 10:18 AM
Ok images work but music doesnt...


<canvas debug="true">
<simplelayout axis="y" spacing="5" />

<view name="foo" />

<button>
<method event="onclick">
foo.setSource( 'http://www.royaltyfreemusic.com/mp3/restaurant_1/01.mp3' );
</method>
</button>
</canvas>


I tested this on the interactive language site:

http://laszlosystems.com/lps/lzxplorer2/lzxplorer.htm

antun
11-06-2003, 11:56 AM
This baffled me for a while...

It looks like there's something wrong with the MP3 that you're trying to run. If you try the same with the MP3s that ship with the Laszlo Dashboard (which are actually encoded higher than the one that you're trying to load).

Apparently, it shows up as MPEG-2.5 Layer 3, when it should be MPEG-1 Layer 3.

We're still going to look into this more.

-Antun

whisperstorm
11-06-2003, 01:04 PM
Gee, you're right. I tried it with another mp3 on another server and it worked fine. Awesome. Glad it's a flaw in the mp3 and not Laszlo.

How would I get the song to loop indefinitely?