var videoNormalPlayer = function (elem) { this.PlayDelay = 1; //1s; var playTimerHandler = null; var isStopped = false; var elemImg = null, dataItems = [], updateInfoCallback = null; var player = null; var stage = 0; //0--connecting, 1-connected, loading data, have not started playing, 2--playing. 3--?, 4--ended var downloadingPercent = 0; this.item = null; var thisVideoPlayer = this; var playNext = function () { if (isStopped) return; if (playTimerHandler != null) clearTimeout(playTimerHandler); var item = dataItems.shift(); if (item != null && item != undefined && (item.fileType == undefined || item.fileType == 1)) { player.item = item; var urlPath = location.protocol + '//' + thumbnailAPI + "/file/DF.aspx?sesID=" + sesID + "&isGallery=&share=" + (shareID > 0 ? "true" : "false") + "&shareID=" + shareID + "&fileID=" + item.fileID + "&a.mp4"; debugInfo("urlPath::" + urlPath); player.src(urlPath); try { if (thisVideoPlayer.PlayDelay > 0 && thisVideoPlayer.PlayDelay <= 32) { player.playbackRate(thisVideoPlayer.PlayDelay); } else { player.playbackRate(1); } } catch (e) { } player.play(); } else { player.item = null; updateInfoCallback(null, 0, 0, 1); // waiting. playTimerHandler = setTimeout(function () { playNext() }, 1000); } }; var checkAndReinit = function () { } /* Initialize the canvas elements and data source. */ this.Init = function (_elemParent, playSpeed, _updateInfoCallback) { this.PlayDelay = playSpeed; elemImg = $("