public/js/music_playlist.js
/**
 * Make timer that shows the elapsed time of the selected song.
 * We also check if the selected song is no longer visible on 
 * the screen and if necessary stop the time updates and video 
 * playback.
 * 
 *  @param {number} songIndex The id of the selected song in songs.
 */
Make timer that shows the elapsed time of the selected song.
We also check if the selected song is no longer visible on
the screen and if necessary stop the time updates and video
playback.

@param {number} songIndex The id of the selected song in songs.
Make timer that shows the elapsed time of the selected song . We also check if the selected song is no longer visible on the screen and if necessary stop the time updates and video playback . @param { number } songIndex The id of the selected song in songs .
function updateTimerDisplay(songIndex){
    if (!document.getElementById('songTime' + songIndex.toString())) {
        window.clearInterval(timerInterval);
        YouTubePlayer.stopVideo();
        return;
    }
    document.getElementById('songTime' + songIndex.toString()).innerHTML = '<p>' + formatTime(YouTubePlayer.getCurrentTime()) + ' / ' + formatTime(YouTubePlayer.getDuration()) + '</p>'; 
}
function updateTimerDisplay ( songIndex ) { if ( ! document . getElementById ( 'songTime' + songIndex . toString ( ) ) ) { window . clearInterval ( timerInterval ) ; YouTubePlayer . stopVideo ( ) ; return ; } document . getElementById ( 'songTime' + songIndex . toString ( ) ) . innerHTML = '<p>' + formatTime ( YouTubePlayer . getCurrentTime ( ) ) + ' / ' + formatTime ( YouTubePlayer . getDuration ( ) ) + '</p>' ; }
Make timer that shows the elapsed time of the selected song.
Make timer that shows the elapsed time of the selected song .
// Update current time text display. // Format: 00:00 / 00:00