Play more than one song in a web page
I'm working on my HTML and Javascript project and I wanted to add mus开发者_运维知识库ic for the website..
Is there any way I can put more than one song in the code to be played? And is there anyway that the song will continue when openning the next page?
Without using Flash, you are bound to a new HTML5 technique <audio/>
, which is supported in Firefox 3.5+, Safari 4+, Chrome 3+, and Opera 10+. Here is an example:
<audio src="path/to/some/audio.file" autoplay>
This is a fall back for old browsers, here you could implement a Flash based audio player
</audio>
I'm not sure if it is possible to continue the song when opening the next page, maybe you could store player data in a cookie.
Here is a similar question with some good answers. The comments in that question list many duplicate questions as well. Many of those answers require HTML5. There are also various Flash-based answers as well.
If you want the song to continue when opening the next page you will need to use frames (easy) or make your website entirely AJAX-driven (more tedious).
精彩评论