Jump to content

Playing Music in website using PHP


raji20

Recommended Posts

How to play a music throughout the website using PHP code .ie I want to play music in all pages of my website but I dont want the song to start from the beginning every time when a link is clicked.
The song list will be coming from the database, where admin can able to upload the music file.
Can anyone help me.Please
Link to comment
Share on other sites

Plus, it won't work in Firefox or for those with popup blockers, and the rest of your visitors will likely be annoyed.
If someone wants to hear music, they'll have it playing. Let them choose when they want to listen to the music, forcing music to play is considered very rude.
Link to comment
Share on other sites

I agree with Jesirose..

There is nothing more annoying than forgetting the sound is not muted on the pc and go to a page that has some crappy music playing or sounds in the ads and end up blasting it out at 2 am.

I feel that sounds in a webpages have their place and that place is very limited. It's a web annoyance in my book.. but thats just me.

Link to comment
Share on other sites

Google xspf mp3 player it's an os flash based mp3 player.  Very easy to add to a website (let me know if you need help) and uses the os xspf playlist format.  If that's not to your liking there is one called flam and probably a bunch on sourceforge.net.  You won't find a php based mp3 player since php is server-side.  You instead want a client side player that pulls its mp3's of your server.

Now with xspf you will need to generate the playlist from whats stored in your sql db.  I'll assume you have track, artist, file link ( I hope your not storing the mp3 in your mysql db).  To do this programitcally you will need loop through each row  returned and append to xspf file in the proper format.

I am not sure what some of the other ones look like.  I think some have direct mysql integration, but i'll leverage the os one.  Ping me if you need help.  I'm working on something very similiar.
Link to comment
Share on other sites

I thort maybe but only maybe you could be crafty and randomly play varous tunes buy enbededing the player in a template for the header, So each page the user goes to they here diffrent tunes But you will not be able to keep one tune playing constantly with php, Sorry tried meny times and javascript was the best result or this way.
Link to comment
Share on other sites

[quote author=s0c0 link=topic=124830.msg517844#msg517844 date=1170227989]
IF a php mp3 player were possible, which I don't think it is, but then again i don't know all that much about php.
[/quote]

PHP is a server-side scripting language. This means that anything done in PHP happens independent of the browser, and before anything is sent to the client. Once you've sent information to the client, PHP is completely out of the picture - PHP runs, generates output, and passes that information to the browser.

Short version: It's not possible.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.