A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 36

Thread: Playing a stream from a position

  1. #1
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299

    Playing a stream from a position

    Hi,

    flash can play streams (mp3, wav) from any position (if it was loaded). I can't figure out how this works with 3dfa.

    Can anyone help me?

    I tried this which won't work:

    PHP Code:
        music.start();
        
    music.position the_new_position
    thx

  2. #2
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    I figured it out.

    music.start(wanted_position_in_seconds/1000); //position in millisecs

    now i want to make a mp3 stream player with xml playlist. maybe a server side, php driven playlist.
    Last edited by lopez1_de; 08-05-2004 at 12:07 PM.

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Cool I was trying to figure that out myself and was at a loss

  4. #4
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    am i the only one here who never figure my mistakes up by myself...well the hard ones i dont...the small stupid stuff i am (random stuff etc)
    ok....what ?

  5. #5
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    jeah. watch this..

    done with 3dfa

    mp3 stream player v1

    still working on xml playlist

    have a nice day

  6. #6
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    don't forget that you can use the positionbar to goto any loaded song position!

    and that id3 tag is displayed in the scroller! (i used getid3.org)

  7. #7
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Very cool indeed

    What is Audio Archive?

  8. #8
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    audioarchive is a server where you can place your music files. a free storage for music

  9. #9
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    I need 7 more posts to have an avatar


    now 6

  10. #10
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    its always nice to see some one who finished his work...nice job

    i afried i toke on myself some project wich will take mounths to finish...

    anyway good job on that player ove there , im curiose ,how did you make the song name to appeer as small dots ? and hod did you make it move from right to left ?
    ok....what ?

  11. #11
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    thx. it's good to hear that somebody like that work.

    1:
    ok. the dot font is a simple font i found on the web.
    be shure that the font has a fixed width!!

    2:
    and here the scroller code

    first place a edit box and set the variable to "scroller"

    startup script:
    PHP Code:
    scroll_max=19;   //the maximal characters to display
    scroll_pos=0;  // initial scroller position
    scroll_dir=true;  //scroll direction, true=scroll right, false=scroll left
    scroller "MP3 STREAM PLAYER"//the initial text of the scroller 
    then we need a timer, started every 10 frames (20 frames/second is the movie set).
    timer script:
    PHP Code:
    if (songname!=""){
        if (
    scroll_dir==true) {
            
    scroll_pos++;
        } else {
            
    scroll_pos--;
        }

    now the scroller script: (songname is the string with the song title)
    runs every 1 frame!
    PHP Code:
        scroller songname.slice(scroll_pos,scroll_pos+scroll_max);

        if ((
    scroll_pos+scroll_max)==songname.length && scroll_dir==true) {
            
    scroll_dir=false;
        }
        
        if (
    scroll_pos==&& scroll_dir==false) {
            
    scroll_dir=true;
        } 
    thats it

    next week i show you the xml playlist feature.
    this player will play local files also! listen to cd's, local files and web streams. what a nice thing.


    my inspiration:
    wimpy player

  12. #12
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    now i have done the xml playlist.

    have a look http://www.ejected.de/player/

    try do play a local file with

    file:///c:\anyfile.mp3


    have a nice day

  13. #13
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    please report bugs here.

    thank you!

  14. #14
    Junior Member
    Join Date
    Jul 2004
    Location
    Grave yard
    Posts
    22

    Man

    That is 1 nice program well u should make it downloadable to becuz its small and alot better to use while playing games then windows media player lol
    Kill them the hard,Kill them fast!

  15. #15
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    its cool all right and all but i think i can make it even cooler if ill photo my sterio and make it as a skin for your program , if you like just send me the sorce file and ill try to make it when ill have some free time , all credit of cours will go to you ....
    ok....what ?

  16. #16
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    This is really great... Good work!

    I hope you will share your source, but I understand if you don't

  17. #17
    Ride 'em FISHY! neederofhelp's Avatar
    Join Date
    Oct 2003
    Location
    I Forgot!
    Posts
    217
    Being like the only one who has dial-up on this forum...

    The player doesn't work exactly right with a dial-up connection. It messes up the song because it doesn't have time to load the entire song before reaching the end. So the bar that shows the position of the song is going back and forth.
    Dan

    Oops. I broke it.... again.

  18. #18
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    That is 1 nice program well u should make it downloadable to becuz its small and alot better to use while playing games then windows media player lol
    yes, if it's finished i'll make it downloadable for everyone. but without the 3dfa source file

    its cool all right and all but i think i can make it even cooler if ill photo my sterio and make it as a skin for your program , if you like just send me the sorce file and ill try to make it when ill have some free time , all credit of cours will go to you ....
    yeah. another skin would be great. but its hard to change the pictures in the moment.


    This is really great... Good work!

    I hope you will share your source, but I understand if you don't
    thank you. i don't like to share the source. but if somebode have a question. ask me!

    Being like the only one who has dial-up on this forum...

    The player doesn't work exactly right with a dial-up connection. It messes up the song because it doesn't have time to load the entire song before reaching the end. So the bar that shows the position of the song is going back and forth.
    yes you be!

    what you think i can do to fix this. for modem users (or somebody who have not anough bandwith to stream files) the player must wait until a minimum ammount auf bytes are loaded until it starts playing. mh
    what do the others think?


    now most bugs are fixed. the playlist is a fully xml formatted playlist.
    note: only id3v2 is supported. because id3v2 is on the beginning of a file (id3v1 at the end). to show id3v1 tags the whole song must be loaded. but the id3tag is received with a php script and downloaded to a webserver. (this is to much traffic)

    you can play local files with:
    file:///c:\anyfile.mp3

    MP3 STREAM PLAYER


    please feel free to save playlists and use this player.
    please report bugs. the final version is for free download.

    bye
    visit my homepage -> ejected.de

  19. #19
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    how are you loading the XML file? I notice that the flash player askes for permission to access a file so I assume you are not using loadXML, or is that for the file itself?

    I totaly understand about not releasing the source code, but how about a sample of the XML and the parsing of the XML and how you load the mp3 files.

  20. #20
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    how are you loading the XML file? I notice that the flash player askes for permission to access a file so I assume you are not using loadXML, or is that for the file itself?

    I totaly understand about not releasing the source code, but how about a sample of the XML and the parsing of the XML and how you load the mp3 files.
    loading xml:
    PHP Code:
    list_xml = new XML;
    list_xml.ignoreWhite;
    list_xml.load (base_url+"/playlists/"+loadthis_playlist+".xml");

    if (
    list_xml.loaded){
        var 
    rootnode list_xml.childNodes[0];
        for (
    n=0n<rootnode.childNodes.lengthn++){
            
    track_counter++;
            var 
    node rootnode.childNodes[n];
            for (var 
    i=0i<node.childNodes.lengthi++){ 
                var 
    chnode node.childNodes[i];
                
    track_name[track_counter]=getsongname(chnode.childNodes[0].toString());
                
    track_url[track_counter]=chnode.childNodes[0].toString();
            }
        }
        
    show_tracks();

    load mp3 file:
    PHP Code:
        if(track_counter>0){
            if (
    music_pause==true) {
                
    music_pause=false;
                
    music.start(pause_pos/1000);
            } else {
                if(
    track_play==0){
                    
    track_play=1;
                    
    url track_url[track_play];
                }
                
    reset_scroller();
                
    music=new Sound();
                
    music.loadSound (url,true);
                
    music.start();
            }
            
    music.setVolume (volume);
            
    element ("playpos").show();
            
    element ("play_perc").show();
            
    music_play=true;
            
    status="PLAY >";
                
            
    songname=getsongname(url);
            
    trackcount=track_play+"/"+track_counter;
                
            
    // get id3 tag
            
    if (got_id3==false) {
                if (
    url.substr(0,7)=="http://"){
                    
    //web file -> id3v2 only
                    
    loadVariables (base_url+"/id3.php?id3v=2&remotefilename="+url,"POST");
                } else {
                    
    //local file
                
    }
            }
        } 

    have a nice day
    visit my homepage -> ejected.de

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center