I was actually able to make music play continuously throughout the pages without reloading, using frames (I know music playing continuously is not a good idea but the client really requested it, so I had no choice). Here is what I used for the frame with the music playing:
<body>
<div id="player">
<audio id="audio" controls="controls" autoplay="autoplay" loop="loop" style="width:150px;">
<source src="martnalia05namoracomigo.ogg" type="audio/ogg" />
<source src="martnalia05namoracomigo.mp3" type="audio/mp3" />
<embed src="martnalia05namoracomigo.mp3" hidden="true" loop="TRUE" autostart="TRUE"></embed>
</audio>
</div>
</body>
I inserted this music just to test, and I would like to know if it is possible to make a play list and if it is possible to inform the music which is currently playing with a link in it and a button to skip a music, for example:
[player]
| button previous | button to play/pause | button next
| name of the music (link to the page of the Album) |
[end of player]
Any suggestions?
Earworms are acoustic memories that repeat until they fade away, or perhaps are replaced with a different melody. Annoying, but it's probably not dangerous. This is just one type of repeating mental loop or cyclical mental activity.
According to experts, 98% of us get stuck on a song, known as an earworm. Certain people are more prone to earworms. Those with obsessive-compulsive disorder or who have obsessive thinking styles experience this phenomenon more often. Musicians also frequently get earworms.
“Earworms” are unwanted catchy tunes that repeat in your head. These relentless tunes play in a loop in up to 98% of people in the western world.
Previous research has shown a person might be more prone to earworms if they are constantly exposed to music, and certain personality traits — such as obsessive-compulsive or neurotic tendencies — can make people more likely to get songs stuck in their heads.
The German word is Ohrwurm . It translates literally as “earworm” and has two meanings: the common name of the earwig, and a colloquial term for a song that gets stuck in your head.
You are wanting to make a small media player perhaps, if thats the case there are plenty of ready made script available to help you accomplish this. (Google is your friend).
If you do decide to go about it on your own here are my thoughts, they may help you in the right direction.
var data = [{audiourl: "filename1.mp3", artisturl:"http://example.com",name:"Song name"},
{audiourl: "filename1.mp3", artisturl:"http://example.com",name:"Song name"}];
Some sort of data structure to store the details of your tracks.
var audio = document.getElementById("audio");
audio.addEventListener('ended', playNext);
Finally some sort of function to handle the switching of tracks
var currentTrack = 0;
function playNext(options){
currentTrack++;
if (currentTrack > data.length){
currentTrack = 0;
}
var audiosrc = document.getElementById('embed_element_id') // or some other selector method
audiosrc.src = data[currentTrack].audiourl;
audiosrc.play();
}
Im not totally sure on the HTML5 audio specification but i would assume its along these lines.
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With