var videoFastPlayer = function () { this.PlayDelay = 1000; //1s; var playTimerHandler = null; var isStopped = false; var elemImg = null, dataItems = [], updateInfoCallback = null, w, h; this.item = null; var looplyPlay = function (player) { if (isStopped) return; if (playTimerHandler != null) clearTimeout(playTimerHandler); var item = dataItems.shift(); if (item != null && item != undefined) { player.item = item; var urlPath = "//" + thumbnailAPI + "/api/Camera/GetCameraThumbnail.ashx?sesID=" + sesID + "&isGallery=&share=" + (shareID > 0 ? "true" : "false") + "&shareID=" + shareID + "&fileID=" + player.item.fileID + ""; debugInfo("path::" + urlPath); var img = new Image(); img.src = urlPath; $(img).load(function () { player.w = img.width; player.h = img.height; $(elemImg).attr("src", $(img).attr("src")); if (updateInfoCallback != null) { updateInfoCallback(player.item, img.height, img.width, 0); //playing... } }); } else { updateInfoCallback(null, 0, 0, 1); // waiting. } if (player.PlayDelay < 0) player.PlayDelay = 1000; else if (player.PlayDelay > 1000 * 10) { player.PlayDelay = 10 * 1000; } playTimerHandler = setTimeout(function () { looplyPlay(player) }, 2000); }; /* Initialize the canvas elements and data source. */ this.Init = function (_elemParent, playSpeed, _updateInfoCallback) { this.PlayDelay = playSpeed; $(_elemParent).empty(); elemImg = $(""); $(_elemParent).append(elemImg); updateInfoCallback = _updateInfoCallback; }; /* Start to play. */ this.Play = function (_dataItems) { dataItems = _dataItems; isStopped = false; looplyPlay(this); }; /* Stop to play the images. */ this.Stop = function () { if (playTimerHandler != null) clearTimeout(playTimerHandler); isStopped = true; }; /* Request full screen */ this.FullScreen = function () { //player.requestFullscreen(); return false; } /* Exit full screen. */ this.ExitFullScreen = function () { //player.exitFullscreen(); return false; } /* Reset playing context. */ this.Reset = function () { //do nothing. } this.Getdimension = function () { if (player != null) { if (this.w > 0 && this.h > 0) { return new Array(this.w, this.h); } else { return new Array($(elemImg).width(), $(elemImg).height()); } } else { return new Array(0, 0); } } this.Zoom = function () { } this.GetPlayingVideo = function () { return this.item; } this.Mute = function () { }; return this; }