PDA

View Full Version : Playing MP3 stream with metadata


scirocco
05-26-2009, 11:46 AM
Hi!

I'm trying to create a simple media player for a website.
I found an example code, but it doesn't work for me!


<canvas>

<simplelayout axis="y" inset="10" spacing="5"/>
<constantlayout axis="x" value="10"/>
<videoview>
<mediastream id="s"
url="http://radiofortuna.hu:8000/radiofortuna-stereo.mp3"
debug="true"
autoplay="true" />
</videoview>
<button text="play" onclick="s.play()"/>
<button text="pause" onclick="s.pause()"/>
<text text="${'playtime: ' + s.playtime}"/>
<text text="${'totaltime: ' + s.totaltime}"/>
<text width="300" multiline="true"></text>

</canvas>

Debug console:
mediastream #s set muteaudio=false called by (void 0)
mediastream #s set paused=false
mediastream #s set mutevideo=false called by (void 0)
mediastream #s set type='http' called by (void 0)
mediastream #s set url='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3' called by (void 0)
mediastream #s set mode='' playing=null paused=null
mediastream #s init immediateparent=/videoview, url='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3'called by (void 0)
mediastream #s set url='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3' called by (void 0)
mediastream #s type='http' creating internal flash stream, _nc=[object NetConnection] _flashstream=null url='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3' callback='seek'
mediastream #s seek('number' 0) fs=null
INFO: mediastream _onNetStatusAS3() NetConnection.Connect.Closed
INFO: mediastream _onNetStatusAS3() NetConnection.Connect.Success
mediastream #s set paused=true
mediastream #s play url='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3'start='either' pause=true length='end' reset=true
mediastream play «<mediastream>#0| #s» _flashstream «flash.net::NetStream#5| [object NetStream]» type http url http://radiofortuna.hu:8000/radiofortuna-stereo.mp3
mediastream #s set mode='playing' playing=false paused=false
mediastream #s type='http' creating internal flash stream, _nc=[object NetConnection] _flashstream=null url='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3' callback='_play'
mediastream #s seek('number' 0) fs=null
INFO: mediastream _onNetStatusAS3() NetConnection.Connect.Closed
INFO: mediastream _onNetStatusAS3() NetConnection.Connect.Success
mediastream play PAUSE «<mediastream>#0| #s» start -2 pause true length -1 reset true
mediastream #s set paused=true
mediastream #s play initiated sname='http://radiofortuna.hu:8000/radiofortuna-stereo.mp3' mode='playing'
INFO: mediastream _onNetStatusAS3() NetStream.Play.StreamNotFound
mediastream #s _onStatus 'NetStream.Play.StreamNotFound' {code: 'NetStream.Play.StreamNotFound', level: 'error'} time=0
WARNING: mediastream _onStatus not handled #s 'NetStream.Play.StreamNotFound' {code: 'NetStream.Play.StreamNotFound', level: 'error'}
lzx> Debug.inspect(«LzWarning| mediastream _onStatus not handled…»)
«LzWarning#10» {
backtrace: (void 0)
file: null
length: NaN
line: 0
message: "mediastream _onStatus not handled #s 'NetStream.Play.StreamNotFound' {code: 'NetStream.Play.StreamNotFound', level: 'error'}"
}
«LzWarning#10| mediastream _onStatus not handled #s 'NetStream.Play.StreamNotFound' {code: 'NetStream.Play.StreamNotFound', level: 'error'}»
lzx>



What could be the problem?

edit:
It doesn't play the mp3.
view plays it but in this case i can not read the metadata

bakchuda
05-28-2009, 11:20 AM
Not sure if it would work for your situation, but you can get the MP3 to play if you load it as a view resource rather than a videoview.

that is, replace the videoview and the mediastream with:


<view resource="http://radiofortuna.hu:8000/radiofortuna-stereo.mp3"/>



you can also get some of the playback controls and some idea of what's loaded and what's buffered with this:


<canvas>

<simplelayout axis="y" inset="10" spacing="5"/>
<constantlayout axis="x" value="10"/>
<view id="s"
resource="http://radiofortuna.hu:8000/radiofortuna-stereo.mp3"/>
<button text="play" onclick="s.play()"/>
<button text="stop" onclick="s.stop()"/>
<text text="${'playtime: ' + s.frame}"/>
<text text="${'totaltime: ' + s.totalframes}"/>
<text width="300" multiline="true"></text>

</canvas>

rtaylor777
06-29-2009, 07:28 AM
<canvas>
<simplelayout axis="y" inset="10" spacing="5"/>
<view resource="nastya2.jpg"/>
<constantlayout axis="x" value="10"/>
<view id="s" resource="http://scfire-dtc-aa01.stream.aol.com:80/stream/1074"/>
<button text="play" onclick="s.play()"/>
<button text="stop" onclick="s.stop()"/>
<text text="${'playtime: ' + s.frame}"/>
<text text="${'totaltime: ' + s.totalframes}"/>
<text width="300" multiline="true"></text>
</canvas>
This is not working for me. Any ideas?
I'm not seeing any compile time or run time errors and I'm not seeing any security warnings.
Thank you,
Robert Taylor

rtaylor777
06-29-2009, 08:05 AM
Pure Java winamp clone playing the same stream. Java Web Start Launcher link.
997 stream http://scfire-dtc-aa01.stream.aol.com:80/stream/1074 (http://www.javazoom.com/jlgui/jws/jlgui_jnlp.jsp?skin=http%3A%2F%2Fwww.javazoom.com% 2Fjlgui%2Fjws%2Fskins%2Fmetrix&song=http%3A%2F%2Fscfire-dtc-aa01.stream.aol.com%3A80%2Fstream%2F1074&start=true&showplaylist=true&showequalizer=true)

I have seen some flash players that are able to play these streams.

I have seen some hints that there could be security issues accessing streams from domains other than where the flash player has loaded. But I have seen players doing it. Also I would expect to see a security warning if that is what is wrong.

Oh ya, I have OpenLaszlo 4.3.0 and have compiled to swf8, swf9 and swf10
when testing.

Any help would be appreciated thank you,
Robert Taylor