Skip to main content
Inspiring
September 15, 2006
Question

simple mp3 player

  • September 15, 2006
  • 1 reply
  • 378 views
Outside of the clunky media player component can someone give me guidance on how to setup a custom player with these functions. A counter/timer would be nice too but all I have is script for play and stop which looks like this:
client_nc = new NetConnection();
client_nc.connect("rtmp://"+_level0.rtmpserver+"/fooserver/");
play_btn.onPress = function() {
in_ns.close();
in_ns = new NetStream(client_nc);
Replay_video.attachVideo(in_ns);
in_ns.setBufferTime(5);
in_ns.play("audio.mp3");
};
stop_btn.onPress = function() {
in_ns.close();
};

I'm basically just looking to add some script to this to add a scrubber and a timer/clock if possible. Many thanks for any help in advance!

Regards,
-Kjup
    This topic has been closed for replies.

    1 reply

    Inspiring
    September 22, 2006
    It looks like you are using code to play flash video (FLV), and not an MP3. Make sure you are using the sound object to play mp3s.

    Here are a couple good tutorials:
    http://kennybellew.cowfly.com/tutorial/
    http://www.lynda.com/info/books/flash8btb/sample.aspx

    First steps to play an mp3 using actionscript (see the tuts for more details)

    - Define an empty movie clip in actionscript
    - Create the sound object variable
    - Load the sound set it either to start streaming/playing right away (true), or load completely without playing (false)
    - Start the sound (using movieclips)

    Play, pause/stop buttons
    PLAY - use the start(); command. to start at beginning of mp3 you don't need to set any value.
    PAUSE - capture the POSITION of the mp3 to a variable when this button is pressed. In your start button, you add the variable inside the brackets start(). position is captured in milliseconds so you have to divide by 1000 to get seconds.
    STOP - use stop('name of sound'); , or stop(); or stopAllSounds();

    Progress Bar:
    Adobe LiveDocs
    http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001581.html
    Participant
    December 12, 2007
    Hi Guys,

    This is the kind of thing I am looking for, but the mp3 is caching. I purchased Media server to stop users from caching my mp3s. Can anybody help me with making a player that has the functionality of the myspace player without the mp3 being stored in the users cache folder.

    Thanks