English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi. I want to make my page to play some music (if the user wants). I store some free-sharing music in my site's ftp, and I know that music playing can be made using tag. That will not be the problem I guess.. But there are some following things: I want to add to my database what files of audio are in my website, so I would be able to play them randomisly and depending on what style user likes. The problem is that: how can I make music allways going on (even if user is exploring my website and going from one page to another) - I do not want the music being interupted? Is there any sollution? Thank you. Please help me!

2007-09-18 04:02:21 · 3 answers · asked by kolibrizas 3 in Computers & Internet Programming & Design

Example to make this clear. User goes to index.php - the audio file "x1.mp3" starts. He goes to users.php, while the page was loading, there was "x1.mp3" going on. Once he loaded users.php the file "x1.mp3" is continuing without any interruption, so he is now listening "x1.mp3" for (for example) a minute. He reads some articles on that page and decides to go to chat.php page. Once he decides another file "x35.mp3" has been playing for two minutes. And so on.

2007-09-18 04:19:15 · update #1

3 answers

Simple solution: use frames. You can have one frame take 100% of the page, and the other take * (which means "take up whatever space is left) and put any code you want in the hidden frame. You could even put a Flash player or something similar (which I would recommend since those work the most reliably and predictably on the widest number of systems).

Additional complexity comes when you want people to actually know where they are in the site. Obviously, your site URL will always be "www.yoursite.com" for every page that you use the frames. This can be solved using an anchoring technique - essentially, include a JavaScript on every page that finds all tags on the page and adds an event to them. This will ensure your site still works if JS is disabled.

The event should say "take the href of the link and append it to the parent location (the browser that contains the frames) like so:

Original url:
A Link

Script makes the URL in the browser:

http://www.site.com/#about.php

If you use the # prefix, the browser will treat it as an anchor and not move away from the original frames page, but users will still see the URL changing as they navigate the site.

You can also include a JavaScript in your parent frames page that does the opposite - reads the URL to see if there is a # sign and loads whatever is after that (in this case, about.php) into the main frame. That way if someone bookmarks a specific page or sends a link to someone else, it will take them to that page even though you are using frames.

That can be quite alot if you've never done anything like that before, but it's extremely effective. I think it adequately solves all your requirements without doing anything burdensome on the user, and it's not very difficult to implement. If you need any help with the details, just let me know. Cheers

/Rex

2007-09-18 06:06:20 · answer #1 · answered by Rex M 6 · 0 0

Once you load another page, that's it! Whatever you had playing will stop.
You have two options: make your "other" page a pop-up (not my favorite), or use AJAX and keep your "player" running (much more complex)
See the example on www.skytargets.com, index page:
See the player: click on "T" on the player. Music starts. (Yes, I play guitare too!)
Now click on "Gazette" (a little above the player, middle):
A pop-up of the gazette comes up, but the music continues.
Click the cross to close the pop-up.
The pop-up goes, but the music continues...
Now, if your pop-up is target=_BLANK and designed for full window, it will just cover the user's screen: you have actually opened another "tab" on the browser. The original "_PARENT" is STILL active!
Open a second IE7 (or another tab!): the music still play...
But if you reload the page, that IS IT. Gone.
Using Ajax is more complex: you have to create a division (maybe hidden), that will be the playing music. You can now change all the rest at will, as long as you do not "overwrite" the division.
(Now I have never put an embedded object in a division, but I don't think it should fail)
Good luck!
Keep me informed.

2007-09-18 05:39:55 · answer #2 · answered by just "JR" 7 · 1 1

loop=true

2007-09-18 04:07:12 · answer #3 · answered by JavaScript_Junkie 6 · 0 2

fedest.com, questions and answers