SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard
    Join Date
    Jul 2006
    Location
    New Zealand
    Posts
    1,300
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Javascript Mp3 Player

    Hi all,

    i am wanting to develop a mp3 player written in php and javascript how i am hoping this to work is when the user plays the website i want to save the current duration into the database with the name of the song and the link so as they move through out the website they can continue to play the song without starting over if the song is at the end then play the next song in the playlist?

    How can i go about that?

    Thanks,William

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML 5 is your friend!

    Generally speaking, you'll obviously need a database, and a PHP script that can edit it. What you would need to do is load your audio into your HTML with HTML 5 audio and Javascript.

    Good tutorial here:
    Everything you need to know about HTML5 video and audio - Dev.Opera

    Your audio would be a Javascript object, then, when someone navigates away from the page, have a JavaScript callback that will get the "currentTime" of your audio Javascript object, send that time to your PHP script (I think ajax would be used), and it would dump it into the database.

    When the user comes back to the webpage, look them up in the database, find their playlist and current time, set the new Javascript object to that, and that should do it.

    Also, try using jQuery to help.
    Sorry if this is a bit vague.


Bookmarks

Posting Permissions

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