A Flash Developer Resource Site

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

Thread: Building a Media Player

  1. #1
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40

    Building a Media Player

    I need to build a media player for my site, but don't know where to begin. I read the tutorial on this site, but I'm still lost. I guess some starting questions are:

    How many frames should the movie be?
    Do I have to build my own buttons and everything? I don't mind, just not sure where to start.
    How and when do I add the art for the player?
    Where do I insert the scripting for the buttons, surely not on the stage?

    Any help would be greatly appreciated. It's not a necessary part of my site, I'm just more anxious to learn it, ya know?

    Thanx ahead of time,
    Marshall

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    since this is the sound forum I assume your "media" player will be a sound player, most likely a song player. Otherwise you should ask in another forum like Flash MX Video.

    you need to decide a few things before you start.

    will your song player play one or many songs?
    will the player load songs as users need them or all songs load first?
    are your songs short loops or long songs?
    do you want to work with sound only SWF or native mp3?

  3. #3
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Sorry about the media thing. I did actually mean music. I would like it to only play music. As for the format, I'm not too sure. I want something that will play 20 to 50 full length songs. I'd like it to be close to the same interface as winamp or WMP. Somehow loading each song as it plays so that you would be able to look through the song list and play whichever song you want. A perfect example is the Rancid official site. They have a sweet media player. Here's an example: http://www.bandbuilder.com/rancid/in...ef_code=D23303

    I'm pretty sure I'm getting in way over my head, but I can't help but want to learn how to do it. The songs will be to promote local bands from the Houston area on my business site. www.houstonwakeboarding.com

  4. #4
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    ----
    20 to 50 full length songs
    ----
    in this case you will probably want to try streaming the sounds.

    I would suggest you try doing this with sound only SWF and not mp3 because the mp3 approach is more complex.

    To stream sounds,

    1. add your sound to frame 2 the root timeline of a new FLA
    2. add enough frames to the sound's keyframe to see its entire waveform.
    3. set the sound to stream sync in the sync options menu of the inspector.
    4. For sound set to stream sync, choose compression from the Flash tab of the publish settings window streamed sounds, not from the sound properties window.
    5. publish the FLA as Flash 4 or 5 SWF to ensure backward compatibility.


    Take a look at FAQ#5-6 for guidance on how to load sounds from a simple menu interface.

  5. #5
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Sweet, Thnx a lot. I'll try it and see what comes of it, and let you know the results. How and where do I add all the art and buttons?

  6. #6
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Ok, I'm lost. Is there anyway I can find this code open source? ..Or at least a tutorial I can be walked through this? I thought I could figure it out, but truth is, I have no idea where to start.

    I tried to do the things you said and read a few other threads, but I don't even know how to see the waves in the timeline of my movie, if that's even what I'm supposed to be building.

  7. #7
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    It is a good idea to break down a larger problem into its smaller sub problems.

    A song player typically does these things:
    user chooses a song
    song loads
    song plays
    user can stop/restart the sound

    The main technical task is getting the song to load.

    So perhaps you just focus on this simple task.

    For example, make a button that loads an external SWF with a graphic.
    If you see the graphic appear in the player after clicking the button then you have learned how to load a SWF.

    ----
    I don't even know how to see the waves in the timeline of my movie
    ----
    do you know the difference between a keyframe and a regular frame?

  8. #8
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Yes, a keyframe starts and ends right? The regular frames are in between the keyframes, but y would you have an epty keyframe? I've done a little work with Flash, but not a whole lot. I figured out yesterday how to see the waves of the mp3 in my timeline. I got it to play when I tested the movie, but couldn't really figure out a way to control the sound. I think I could get the number of songs I want into the movie, but won't know how to choose one. ...Or make the others play.

  9. #9
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    ok, so you are making some progress...

    next issue is learning how to load a new song from a user request. You dont want to have all the songs inside one SWF because it will be to large of a download.

    do you know how to use loadMovie()?

  10. #10
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Nope, don't know how to use loadMovie()?

    I just found SwiftMp3, I think I'm going to go ahead and buy it, but I'm still wanting to learn how to do this. I don't plan on buying Swift for a few days, if I get it. Do you know anything about it? I have the trial version, but when I open the players in Flash, I still don't know how or where to load the songs.

  11. #11
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Ok, I think I had a breakthrough. I hope I'm not just confused as hell. Here goes.

    I'm making a movie 1 for the player, with buttons and script to load the other movies I have to make which will be mp3's loaded saved as .swf's? I thought everything was in one movie at first, that wasn't working out to well for me.

    How do I do the anims that would sync to the streaming audio? Like on the cd player face that's in my car.

  12. #12
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    ----
    I'm making a movie 1 for the player, with buttons and script to load the other movies I have to make which will be mp3's loaded saved as .swf's?
    ----
    yes, this is correct.

    You can use swiftMP3 to convert mp3 to swf automatically or you can follow the steps in Post #4 from this thread. At this point FAQ #5-6 might be more meaningful to you.

    Dont worry about the eq animation until you get song loading and playback control set up. EQ is more advanced.

  13. #13
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Ok, I don't need to get ahead of myself.

    Thanks for the help. I guess I only wanted that prog for the templates, but I'd rather know how to do it on my own.

  14. #14
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Ok, I published my first audio flash movie. Now I can't find it. Where do they go?

  15. #15
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    HOLY CRAP !!!! I GOT IT TO WORK !!!

    I made the first movie a simple movie with 2 buttons and put some code from your tutorial to load a song and they both work. This is so cool. What else can I do?

    Ok, I got it to work on my pc, but when I put it on my server and try to write it into a web page, it doesn't work right. Here's the link: http://www.houstonwakeboarding.com/archive.htm
    I hid it back in my site so no one would really know that I was even fooling with it.

    Nm, it was a rookie mistake. Got too excited and overlooked something important. It werx now, take a look. I still need to figure out how to do the forward, back, and stop buttons.
    Last edited by fat_sac; 12-16-2003 at 02:43 AM.

  16. #16
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    use the stop action to stop or pause.
    use the play action to play and resume.

    to rewind use gotoAndStop(first frame of audio)

    for example:

    Code:
    // rewind button
    // assuming audio starts in frame 2
    on(release){
       targetpath_to_mc_holding_audio.gotoAndStop(2);
    }

  17. #17
    Senior Moderator ®
    FK´s Banning Machine ™
    GMF ™'s Avatar
    Join Date
    Feb 2000
    Location
    Oslo, Norway
    Posts
    5,697
    nice job hp

  18. #18
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Ok, I'm lost again. I've gotten the play button to work and got the stop button to work like this:


    // button for loading song 1
    on(release){
    _level1.unloadMovie(); // stop loading old stream
    loadMovieNum("",1); // load new song into level1
    }

    I doubt it's right, but it works. I couldn't figure out what I was doing wrong with the previous button, it kept saying undifined. I looked at the code in the Q&A forum, but it doesn't make a lot of sense to me.

    You've helped a lot tho, I really appreciate it. Where do I go from here? I'll reload the song on that same page of my site if you want to see it.

    It's a couple hours after that ^^^^ , but I've been looking at this http://www.flashkit.com/tutorials/Ut...-919/index.php and it's been nothing but confusing. Is there anyway you can tell me what I've done wrong?
    Last edited by fat_sac; 12-16-2003 at 10:04 PM.

  19. #19
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    ----
    I've gotten the play button to work and got the stop button to work
    ----

    Code:
    // button for loading song 1
    on(release){
      _level1.unloadMovie(); // stop loading old stream
      loadMovieNum("",1); // load new song into level1
    }
    unloading a movie is a way of stopping it but generally does not give you easy control.

    why didnt you just use the stop action like like I stated 3 posts above? Did you read this particular post? Please read about the stop action in the ActionSript manual.

    also in order for someone to help you, you need to be specific about what you having problems with. Saying you are "lost" or "confused" does not help me understand your problem.

    Is there a specific line of code from FAQ #5 or 6 that you do not understand?

  20. #20
    Banned by GMF ™
    FK´s Banning Machine

    Join Date
    Sep 2003
    Location
    Houston
    Posts
    40
    Ok, I understand, here goes.

    I don't have an actionscript manual and was unaware of what you were talking about, so when you were saying, "Use stop to stop or pause", I had no idea what you were talking about. I'm really green with this program, maybe let on sometimes that I know more than I actually do. I'm going to buy a manual however, so I can read about these scripts.

    I got #5 down, that's no problem.

    #6 however, in the code: "urls = new Array" Is this where I put all the urls I want counted? And when I make this list, do I put it in the action window with the code for the buttons?

    more code: "trace {urls[count[} ; //show url" Is this where I put another list of song urls? If the song movies and the mp3 player are in the same folder on the server, do I need to put the full url in the code? I'm not sure about those things right now. I know they're be more questions, but that's it for now.

    Thnaks again

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