gvhung / as3mp3streamplayer

Automatically exported from code.google.com/p/as3mp3streamplayer
0 stars 0 forks source link

Howto #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I would really like to use this library, the only problem is that i don't
really now how to get started with it.

Is there some kind of little sample app (fla) that just shows how to use
this library to play a shoutcast stream?

Thanks a lot!

Original issue reported on code.google.com by fgdfgdfg...@gmail.com on 9 Mar 2009 at 11:13

GoogleCodeExporter commented 9 years ago
import fly.sound.*;

var ssp:MP3StreamPlayer = new MP3StreamPlayer();
ssp.playStream("http://localhost:8000/");

Original comment by protot...@gmail.com on 9 Apr 2009 at 2:20

GoogleCodeExporter commented 9 years ago
This is the Flex Builder project I tested with:

package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.ByteArray;

    import fly.sound.MP3StreamPlayer;
    import fly.sound.events.SoundBufferEvent;
    import fly.sound.events.TitleChangeEvent;

    public class MP3StreamPlayerTest extends Sprite
    {
        private var _mp3StreamPlayer:MP3StreamPlayer;

        public function MP3StreamPlayerTest()
        {
            _mp3StreamPlayer = new MP3StreamPlayer();
            _mp3StreamPlayer.addEventListener
(TitleChangeEvent.TITLE_CHANGE, _titleChangeHandler);
            _mp3StreamPlayer.addEventListener
(SoundBufferEvent.BUFFER_EMPTY, _test);
            _mp3StreamPlayer.addEventListener
(SoundBufferEvent.BUFFERING, _test);
            _mp3StreamPlayer.addEventListener(ProgressEvent.PROGRESS, 
_test);
            _mp3StreamPlayer.addEventListener(Event.COMPLETE, 
_completeHandler);
            _mp3StreamPlayer.addEventListener
(SoundBufferEvent.BUFFERING, _buffering);
            _mp3StreamPlayer.playStream("http://streamURL:port");
        }

        private function _titleChangeHandler(e:TitleChangeEvent):void
        {
            trace(e.title);
        }

        private function _buffering(e:SoundBufferEvent):void
        {
            trace(e.entriesLoaded, "/", e.entriesTotal);
        }

        private function _test(e:Event):void
        {
            trace("test", e.type);
        }

        private function _completeHandler(e:Event):void
        {
            _sound = _mp3StreamPlayer.sound;
        }

    }

}

Original comment by eeco...@gmail.com on 9 Apr 2009 at 8:03

GoogleCodeExporter commented 9 years ago
Issue 8 has been merged into this issue.

Original comment by eeco...@gmail.com on 9 Apr 2009 at 8:04