I have a music player on this test page. The external JavaScript files called for can be viewed via page source within the head tags. They are
/js/jquery-1.6.1min.js
/js/myplaylist.js
/plugin/ttw-music-player.js (the script for placing checkboxes is found within this file)
I also have two portions of internal JavaScript included:
<script type="text/javascript">
$(document).ready(function() {
var description = '<p align="center">Classic and Southern Rock<br /><i>Check the songs you want, then click the first title checked to begin playing.</p></i><br /><input type="button" onclick="uncheckAll()" value="Clear"/><input class="check" type="button" onclick="checkAll()" value="Select All"/>';
$('#yipPlayer').ttwMusicPlayer(myPlaylist, {
autoPlay: false,
description: description,
jPlayer: {
swfPath: 'plugin/jquery-jplayer'
}
});
});
</script>
and this bit for clearing/selecting the checkboxes:
<script>
function uncheckAll() {
$("input[type='checkbox']:checked").prop("checked", false)
}
function checkAll() {
$("input[type='checkbox']").prop("checked", true)
}
</script>
Something to note: Prior to adding checkboxes, one simply clicked a title and the player's behavior was to continue to progress through the entire list of songs, unless manually paused. After adding checkboxes, the player loads with all the check boxes selected. One must clear all the boxes, then check song choices. Clicking the first selected title then starts the player. The player will progress through all checked songs just fine, until it reaches the end of the last song; then it will start over. If you don't want it to keep repeating the playlist, you must uncheck the boxes. Even with only one song checked, it will repeat that one song, over and over. To stop the repeat, you must uncheck the box. (The player's behavior can be tested by clicking the supplied player link. You may scrub to the end of a song to avoid having to sit through its entirety.)
The issue occurs when all the boxes are unchecked. If the player is allowed to play all the way to the end of the song, the page will freeze. As long as the song is playing, one may pause it, check/uncheck boxes, etc. It is only when no boxes are checked and a song plays completely to the end that the freeze occurs. When this happens, the page no longer responds to any click. One may only close the page tab (in most cases).
This happens regardless of browser (tested in Firefox, Chrome, Safari, Opera). Firefox does give an "Unresponsive Script" alert with this information:
Script: http://ift.tt/29OfaS7 (Why is :16 appearing at the end of that link? Of course, it gives a 404 error.)
I lack the skills to debug JavaScript. Since the script error points to jquery-1.6.1.min.js, I read through this page but do not understand the attributes and properties of checkboxes.
My question is, since the player initially loads with all the boxes checked, is it freezing up because it was originally set up to play through all the songs listed in the player and deselecting checkboxes breaks that function (so that it "doesn't know what to do" when a song reaches the end and nothing is checked)?
Aucun commentaire:
Enregistrer un commentaire