/**
* Dare MoviePlay Object.
* @constructor
*/
//声明构造函数 构造函数初始化变量
Dare.MoviePlay = function () {
this.parent = new Dare.Util();
this.className = 'Dare.MoviePlay';
//----类Dare.MoviePlay全局属性变量-----//
this.stylePath = dareStyle.getStylePath();
this.currentFocus = 'playPlay'; //初始化焦点
this.fastPressCount = 2; //初始化快进按压指令
this.volumePressCount = 0; //音量调节+-增量指令
this.bookMovies = new Dare.Business.Command().getGlobalVar('movieBookList');
this.movieList = null; //影片播放列表
this.moviePlayCount = 0; //播放步长
this.moviePlayTotalTime = 0; //播放总时长
this.moviePlayPercent = 0; //播放进度
this.moviePlayTimer = null; //进度条定时器
this.moviePlayTotal = 0; //播放总数
this.moviePlayIndex = 0; //播放索引
this.moviePlayStatusMode = PlayMode.PLAY; //播放状态模式
this.moviePlayOrderMode = OrderMode.LOOP; //播放遍历模式
this.moviePlayMuteMode = MuteMode.ON; //播放声音模式
this.moviePlayScreenMode = ScreenMode.GENERAL; //屏幕模式
this.moviePlayTimeToString = '';
this.moviePlayVolumeStep = 5; //播放音量步长
this.moviePlayVolume = 50; //播放音量为50
this.movieMediaPlayer = null; //影片播放实例
this.moviePlaySpeedMode = SpeedMode.GENERAL;
this.appendback = false;
this.moviePlaySeekStep = 10; //播放定位步长10秒
this.pageIndex = 0; //列表页索引
//----类Dare.MoviePlay全局属性变量-----//
};
Dare.MoviePlay.prototype = new Dare.Util(); //继承父类 Dare.Util是系统架构工具类
Dare.MoviePlay.prototype.constructor = Dare.MoviePlay; //引用构造函数
/**
* @function: moviePlayInit
* @description: 影片播放主模块初始化
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayInit = function () {
this.$('playPlay').className = 'playPlayPauseOver';
this.$('playVolumnStep').style.width = this.moviePlayVolume + '%';
this.$('playVolumnTitle').innerText = this.moviePlayVolume + '/100';
var json = new Dare.JSObject.JSON();
//从设置读取图片列表
var movieConfig = new Dare.Business.Command().getVideoConfig();
if (movieConfig.playorder) {
this.moviePlayOrderMode = movieConfig.playorder;
this.moviePlayVolume = movieConfig.volume;
this.moviePlayMuteMode = movieConfig.mute;
}
var request = new Dare.Request();
this.appendback = request.QueryString('appendback');
var index = request.QueryString('pageIndex');
this.pageIndex = index == null ? 0 : parseInt(index);
this.movieList = json.toObject(this.bookMovies);
this.moviePlayTotal = this.movieList.length;
this.moviePlay();
};
/**
* @function: moviePlay
* @description: 影片播放入口
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlay = function () {
var request = new Dare.Request();
var currentPlayMovieInPlayList = request.QueryString('currentPlayMovieInPlayList');
if (this.appendback == 'true' && currentPlayMovieInPlayList == 'true') {
this.movieMediaPlayer = new Dare.MediaPlayer();
var media = dareUtil.getGlobalVar('currentPlayMedia');
this.movieMediaPlayer.fromJson(media);
this.$('playingStep').style.width = this.movieMediaPlayer.playPercent + '%';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + ' (' + this.movieMediaPlayer.playPercent + '%)';
this.$('playTime').innerText = this.secondsToMMSS(this.movieMediaPlayer.playTime) + '/' + this.secondsToMMSS(this.movieMediaPlayer.playTotalTime) + ' [' + (this.moviePlayIndex + 1) + '/' + this.moviePlayTotal + ']';
this.moviePlayTotalTime = this.movieMediaPlayer.playTotalTime;
this.moviePlayCount = this.movieMediaPlayer.playTime;
this.$('playVolumnTitle').innerText = this.movieMediaPlayer.playVolume + '/100';
this.$('playVolumnStep').style.width = this.movieMediaPlayer.playVolume + '%';
iPanel.setGlobalVar('currentPlayMedia', '');
this.appendback = 'false';
this.movieMediaPlayer.playResume(); //返回命令
}
else {
this.$('playingStep').style.width = '0%';
this.moviePlayCount = 0;
var wh = this.movieList[this.moviePlayIndex].scale.split('x');
var w = wh[0];
var h = wh[1];
var scale = this.playScaleZoom(w, h, this.moviePlayScreenMode);
this.moviePlayTimeToString = this.movieList[this.moviePlayIndex].time;
this.moviePlayTotalTime = this.mmssToSeconds(this.moviePlayTimeToString);
this.movieMediaPlayer = new Dare.MediaPlayer();
this.movieMediaPlayer.playPath = this.movieList[this.moviePlayIndex].name; // '0,' + this.movieList[this.moviePlayIndex].name;
this.movieMediaPlayer.playType = MediaMode.MOVIE;
this.movieMediaPlayer.playTotalTime = this.moviePlayTotalTime;
this.movieMediaPlayer.playPointX = scale.pointx;
this.movieMediaPlayer.playPointY = scale.pointy;
this.movieMediaPlayer.playWidth = scale.width;
this.movieMediaPlayer.playHeight = scale.height;
this.movieMediaPlayer.playScreenMode = this.moviePlayScreenMode;
this.movieMediaPlayer.playVolume = this.moviePlayVolume;
this.movieMediaPlayer.playMuteMode = this.moviePlayMuteMode;
this.movieMediaPlayer.playOrderMode = this.moviePlayOrderMode;
this.movieMediaPlayer.playMode = this.moviePlayStatusMode;
this.$('playTitle').innerText = this.getFileName(this.movieList[this.moviePlayIndex].name) + ' (' + this.moviePlayPercent + '%)';
this.$('playTime').innerText = "00:00/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
//this.stopIfUsbRemove();//判断u盘拔除
setTimeout("dareMoviePlay.movieStart();", 1000);
}
if (this.moviePlayTimer != null) clearInterval(this.moviePlayTimer);
this.moviePlayTimer = setInterval('dareMoviePlay.movieAutoPlay()', 1000);
};
Dare.MoviePlay.prototype.movieStart = function () {
this.movieMediaPlayer.setPosition();
var r = this.movieMediaPlayer.start();
if (r == 1) {
//document.getElementById('playStatus').innerHTML = '';
//document.getElementById('playBar').innerHTML = '当前影片已经移除,现在回到列表页面';
document.getElementById('playBar').style.display = 'none';
window.location.href = new Dare.Business.Command().getListPage("movie") + '?pageIndex=' + this.pageIndex;
}
};
/**
* @function: movieAutoPlay
* @description: 影片播放处理
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.movieAutoPlay = function () {
if (this.moviePlayStatusMode == PlayMode.PAUSE) return; //暂停
if (this.moviePlayStatusMode == PlayMode.REWIND) {
this.moviePlayCount -= this.moviePlaySpeedMode;
if (this.moviePlayCount < 0) this.moviePlayCount = 0;
this.moviePlayPercent = Math.floor((this.moviePlayCount / this.moviePlayTotalTime) * 100);
if (this.moviePlayPercent <= 100 && this.moviePlayPercent >= 0) {
this.$('playingStep').style.width = this.moviePlayPercent + '%';
if (this.moviePlayCount <= this.moviePlayTotalTime) {
this.$('playTime').innerText = this.secondsToMMSS(this.moviePlayCount) + "/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + ' (' + this.moviePlayPercent + '%)';
}
this.movieMediaPlayer.playPercent = this.moviePlayPercent;
this.movieMediaPlayer.playTime = this.moviePlayCount;
}
}
else {
this.moviePlayCount += this.moviePlaySpeedMode;
if (this.moviePlayCount > this.moviePlayTotalTime)
this.moviePlayCount = this.moviePlayTotalTime;
this.moviePlayPercent = Math.floor((this.moviePlayCount / this.moviePlayTotalTime) * 100);
var playEnd = false;
if (this.moviePlayPercent <= 100 && this.moviePlayPercent >= 0) {
if (this.moviePlayPercent > 2) {
this.$('playingStep').style.width = this.moviePlayPercent + '%';
}
else {
this.$('playingStep').style.width = '2%';
}
if (this.moviePlayCount <= this.moviePlayTotalTime) {
this.$('playTime').innerText = this.secondsToMMSS(this.moviePlayCount) + "/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + ' (' + this.moviePlayPercent + '%)';
}
this.movieMediaPlayer.playPercent = this.moviePlayPercent;
this.movieMediaPlayer.playTime = this.moviePlayCount;
if (this.moviePlayPercent == 100) playEnd = true;
}
if (playEnd && this.moviePlaySpeedMode < 2) {
if (this.moviePlayTimer != null)
clearInterval(this.moviePlayTimer);
this.$('playingStep').style.width = "0%";
this.moviePlayPercent = 0;
this.moviePlayCount = 0;
switch (this.moviePlayOrderMode) {
case OrderMode.SEQUENCE: //顺序
if (this.moviePlayIndex >= this.moviePlayTotal - 1) {
return;
}
else {
this.moviePlayIndex++;
}
break;
case OrderMode.LOOP: //循环
if (this.moviePlayIndex >= this.moviePlayTotal - 1) {
this.moviePlayIndex = 0;
}
else {
this.moviePlayIndex++;
}
break;
case OrderMode.RANDOM: //随机
this.moviePlayIndex = Math.floor(Math.random() * this.moviePlayTotal + 0);
break;
default:
break;
}
this.moviePlay();
}
}
};
/**
* @function: movieStopBack
* @description: 播放返回
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.movieStopBack = function () {
this.movieMediaPlayer.stop();
window.location.href = new Dare.Business.Command().getListPage("movie") + '?pageIndex=' + this.pageIndex;
};
/**
* @function: keyupHandler
* @description: 向上事件
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.keyupHandler = function () {
if (this.moviePlayScreenMode == ScreenMode.GENERAL) {
this.clearFocusStatus();
this.moviePlayStatusMode = PlayMode.PAUSE;
this.currentFocus = 'playArrow';
this.$('playArrow').className = 'playArrowOver';
this.$('playPlay').className = 'playPlay';
}
};
/**
* @function: moviePlaySeekForward
* @description: 向前定位
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlaySeekForward = function () {
this.moviePlayCount += this.moviePlaySeekStep;
this.moviePlayPercent = Math.floor((this.moviePlayCount / this.moviePlayTotalTime) * 100);
if (this.moviePlayPercent <= 100) {
this.$('playingStep').style.width = this.moviePlayPercent + '%';
this.$('playTime').innerText = this.secondsToMMSS(this.moviePlayCount) + "/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + ' (' + this.moviePlayPercent + '%)';
}
else {
this.moviePlayCount = this.moviePlayTotalTime;
this.moviePlayPercent = 100;
this.$('playingStep').style.width = '100%';
this.$('playTime').innerText = this.moviePlayTimeToString + "/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + '(100%)';
}
this.movieMediaPlayer.playPercent = this.moviePlayPercent;
this.movieMediaPlayer.playTime = this.moviePlayCount;
};
/**
* @function: moviePlaySeekRewind
* @description: 向后定位
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlaySeekRewind = function () {
this.moviePlayCount -= this.moviePlaySeekStep;
if (this.moviePlayCount < 0) this.moviePlayCount = 0;
this.moviePlayPercent = Math.floor((this.moviePlayCount / this.moviePlayTotalTime) * 100);
if (this.moviePlayPercent <= 100) {
this.$('playingStep').style.width = this.moviePlayPercent + '%';
this.$('playTime').innerText = this.secondsToMMSS(this.moviePlayCount) + "/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + ' (' + this.moviePlayPercent + '%)';
}
else {
this.moviePlayCount = 0;
this.moviePlayPercent = 0;
this.$('playingStep').style.width = '0%';
this.$('playTime').innerText = "00:00/" + this.moviePlayTimeToString + ' [' + (this.moviePlayIndex + 1) + "/" + this.moviePlayTotal + ']';
this.$('playTitle').innerText = this.getFileName(this.movieMediaPlayer.playPath) + '(0%)';
}
this.movieMediaPlayer.playPercent = this.moviePlayPercent;
this.movieMediaPlayer.playTime = this.moviePlayCount;
};
/**
* @function: moviePlaySeek
* @description: 定位播放
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlaySeek = function () {
this.clearFocusStatus();
this.currentFocus = 'playPlay';
this.$('playArrow').className = 'playArrow';
this.$('playPlay').className = 'playPlayPauseOver';
this.movieMediaPlayer.seek();
this.moviePlayStatusMode = PlayMode.PLAY;
};
/**
* @function: moviePlayPause
* @description: 播放暂停
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayPause = function () {
this.clearFocusStatus();
switch (this.moviePlayStatusMode) {
case PlayMode.PLAY:
this.$('playPlay').className = 'playPlayOver';
this.moviePlayStatusMode = PlayMode.PAUSE;
this.movieMediaPlayer.pause();
break;
case PlayMode.PAUSE:
this.$('playPlay').className = 'playPlayPauseOver';
this.moviePlayStatusMode = PlayMode.PLAY;
this.movieMediaPlayer.resume();
this.$('playStatus').innerText = "";
break;
case PlayMode.FORWARD:
this.moviePlayStatusMode = PlayMode.PLAY;
this.moviePlaySpeedMode = 1;
this.movieMediaPlayer.playSpeedMode = this.moviePlaySpeedMode;
if (this.currentFocus == 'playPlay') {
this.$('playPlay').className = 'playPlayOver';
this.moviePlayStatusMode = PlayMode.PAUSE;
this.movieMediaPlayer.pause();
}
else {
this.$('playPlay').className = 'playPlayPauseOver';
this.movieMediaPlayer.play();
}
this.$('playStatus').innerText = "";
break;
case PlayMode.REWIND:
this.moviePlaySpeedMode = 1;
this.movieMediaPlayer.playSpeedMode = this.moviePlaySpeedMode;
this.moviePlayStatusMode = PlayMode.PLAY;
if (this.currentFocus == 'playPlay') {
this.$('playPlay').className = 'playPlayOver';
this.moviePlayStatusMode = PlayMode.PAUSE;
this.movieMediaPlayer.pause();
}
else {
this.$('playPlay').className = 'playPlayPauseOver';
this.movieMediaPlayer.play();
}
this.$('playStatus').innerText = "";
break;
}
this.currentFocus = 'playPlay';
};
/**
* @function: moviePlayPrevious
* @description: 播放上一个
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayPrevious = function () {
switch (this.moviePlayOrderMode) {
case OrderMode.ORDER: //顺序
if (this.moviePlayIndex <= 0) {
return;
}
else {
this.moviePlayIndex--;
}
break;
case OrderMode.LOOP: //循环
if (this.moviePlayIndex <= 0) {
this.moviePlayIndex = this.moviePlayTotal - 1;
}
else {
this.moviePlayIndex--;
}
break;
case OrderMode.RANDOM: //随机
this.moviePlayIndex = Math.floor(Math.random() * this.moviePlayTotal + 0);
break;
default:
break;
}
this.moviePlay();
};
/**
* @function: moviePlayNext
* @description: 播放下一个
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayNext = function () {
switch (this.moviePlayOrderMode) {
case OrderMode.ORDER: //顺序
if (this.moviePlayIndex >= this.moviePlayTotal - 1) {
return;
}
else {
this.moviePlayIndex++;
}
break;
case OrderMode.LOOP: //循环
if (this.moviePlayIndex >= this.moviePlayTotal - 1) {
this.moviePlayIndex = 0;
}
else {
this.moviePlayIndex++;
}
break;
case OrderMode.RANDOM: //随机
this.moviePlayIndex = Math.floor(Math.random() * this.moviePlayTotal + 0);
break;
default:
break;
}
this.moviePlay();
};
/**
* @function: moviePlayFastForward
* @description: 播放快进
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayFastForward = function () {
switch (this.fastPressCount) {
case 1:
this.$('playStatus').innerText = "";
this.fastPressCount = 2;
this.moviePlaySpeedMode = SpeedMode.GENERAL;
break;
case 2:
this.$('playStatus').innerText = DareLang.SPEED + ":+2X";
this.fastPressCount = 4;
this.moviePlaySpeedMode = SpeedMode.SPEED2;
break;
case 4:
this.$('playStatus').innerText = DareLang.SPEED + ":+4X";
this.fastPressCount = 8;
this.moviePlaySpeedMode = SpeedMode.SPEED4;
break;
case 8:
this.$('playStatus').innerText = DareLang.SPEED + ":+8X";
this.fastPressCount = 16;
this.moviePlaySpeedMode = SpeedMode.SPEED8;
break;
case 16:
this.$('playStatus').innerText = DareLang.SPEED + ":+16X";
this.fastPressCount = 32;
this.moviePlaySpeedMode = SpeedMode.SPEED16;
break;
case 32:
this.$('playStatus').innerText = DareLang.SPEED + ":+32X";
this.fastPressCount = 2;
this.moviePlaySpeedMode = SpeedMode.SPEED32;
break;
default:
break;
}
this.moviePlayStatusMode = PlayMode.FORWARD;
this.movieMediaPlayer.playSpeedMode = this.moviePlaySpeedMode;
this.movieMediaPlayer.fastForward();
};
/**
* @function: moviePlayFastRewind
* @description: 播放快退
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayFastRewind = function () {
switch (this.fastPressCount) {
case 1:
this.$('playStatus').innerText = "";
this.fastPressCount = 2;
this.moviePlaySpeedMode = SpeedMode.GENERAL;
break;
case 2:
this.$('playStatus').innerText = DareLang.SPEED + ":-2X";
this.fastPressCount = 4;
this.moviePlaySpeedMode = SpeedMode.SPEED2;
break;
case 4:
this.$('playStatus').innerText = DareLang.SPEED + ":-4X";
this.fastPressCount = 8;
this.moviePlaySpeedMode = SpeedMode.SPEED4;
break;
case 8:
this.$('playStatus').innerText = DareLang.SPEED + ":-8X";
this.fastPressCount = 16;
this.moviePlaySpeedMode = SpeedMode.SPEED8;
break;
case 16:
this.$('playStatus').innerText = DareLang.SPEED + ":-16X";
this.fastPressCount = 32;
this.moviePlaySpeedMode = SpeedMode.SPEED16;
break;
case 32:
this.$('playStatus').innerText = DareLang.SPEED + ":-32X";
this.fastPressCount = 2;
this.moviePlaySpeedMode = SpeedMode.SPEED32;
break;
default:
break;
}
this.moviePlayStatusMode = PlayMode.REWIND;
this.movieMediaPlayer.playSpeedMode = this.moviePlaySpeedMode;
this.movieMediaPlayer.fastRewind();
};
/**
* @function: moviePlayVolumeUp
* @description: 音量递增
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayVolumeUp = function () {
this.clearFocusStatus();
this.$('playVolumnArrow').className = 'playVolumnArrowOver';
this.currentFocus = 'playVolumnArrow';
this.moviePlayVolume = this.moviePlayVolume + this.moviePlayVolumeStep;
if (this.moviePlayVolume > 0) this.$('playSound').className = 'playSound';
if (this.moviePlayVolume <= 100) {
this.$('playVolumnTitle').innerText = this.moviePlayVolume + "/100";
this.$('playVolumnStep').style.width = this.moviePlayVolume + "%";
}
else {
this.moviePlayVolume = 100;
}
this.movieMediaPlayer.playVolume = this.moviePlayVolume;
this.movieMediaPlayer.setVolume(this.moviePlayVolume);
};
/**
* @function: moviePlayVolumeDown
* @description: 音量递减
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.moviePlayVolumeDown = function () {
this.clearFocusStatus();
this.$('playVolumnArrow').className = 'playVolumnArrowOver';
this.currentFocus = 'playVolumnArrow';
this.moviePlayVolume = this.moviePlayVolume - this.moviePlayVolumeStep;
if (0 == this.moviePlayVolume) this.$('playSound').className = 'playNoSound';
if (0 <= this.moviePlayVolume) {
this.$('playVolumnTitle').innerText = this.moviePlayVolume + "/100";
this.$('playVolumnStep').style.width = this.moviePlayVolume + "%";
}
else {
this.moviePlayVolume = 0;
}
this.movieMediaPlayer.playVolume = this.moviePlayVolume;
this.movieMediaPlayer.setVolume(this.moviePlayVolume);
};
/**
* usb拔除, 判断此媒体所在usb是否被拔除,是则停止播放
*/
Dare.MoviePlay.prototype.stopIfUsbRemove = function () {
var r = this.movieMediaPlayer.stopIfUsbRemove();
if (r == 1) window.location.href = new Dare.Business.Command().getListPage("file");
}
/**
* @function: keypressHandler
* @description: 按键事件
* @param: event
* @return: null
*/
Dare.MoviePlay.prototype.keypressHandler = function (event) {
var keyValue = Dare.isiPanel ? event.which : window.event.keyCode;
//this.$('divDebug').innerHTML += keyValue;
showUSBInfo(keyValue);
switch (keyValue) {
case KeyMap.STB_KEY_USB_CLEAR: //usb拔除, 判断此媒体所在usb是否被拔除,是则停止播放
this.stopIfUsbRemove();
break;
case KeyMap.STB_KEY_DOWN: //向下
//this.keydownHandler();
break;
case KeyMap.STB_KEY_UP: //向上
//this.keyupHandler();
break;
case KeyMap.STB_KEY_ENTER: //确定
this.keyenterHandler();
break;
case KeyMap.STB_KEY_LEFT: //向左
this.keyleftHandler();
break;
case KeyMap.STB_KEY_RIGHT: //向右
this.keyrightHandler();
break;
case KeyMap.STB_KEY_PAGEUP: //上一页
this.moviePlayPrevious();
break;
case KeyMap.STB_KEY_PAGEDOWN: //下一页
this.moviePlayNext();
break;
case KeyMap.STB_KEY_HOME:
this.movieMediaPlayer.stop();
break;
case KeyMap.STB_KEY_FULLSCREEN: //回切
this.keycutbackHandler();
break;
case KeyMap.STB_KEY_VOLUMNUP: //音量+
this.moviePlayVolumeUp();
if (this.moviePlayVolume > 0) {
this.muteOn();
}
else {
this.muteOff();
}
break;
case KeyMap.STB_KEY_VOLUMNDOWN: //音量-
this.moviePlayVolumeDown();
if (this.moviePlayVolume > 0) {
this.muteOn();
}
else {
this.muteOff();
}
break;
case KeyMap.STB_KEY_STOP: //停止/返回
this.movieStopBack();
break;
case KeyMap.STB_KEY_PAUSE: //播放/暂停
this.moviePlayPause();
break;
default:
break;
}
};
/**
* @function: keydownHandler
* @description: 向下事件
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.keydownHandler = function () {
this.clearFocusStatus();
this.$('playArrow').className = 'playArrow';
if (this.$('playPlay').className == 'playPlayPause') {
this.$('playPlay').className = 'playPlayPauseOver'
}
else if (this.$('playPlay').className == 'playPlay') {
this.$('playPlay').className = 'playPlayOver'
}
this.currentFocus = 'playPlay';
};
/**
* @function: clearFocusStatus
* @description: 清除焦点
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.clearFocusStatus = function () {
switch (this.currentFocus) {
case 'playVolumnArrow':
this.$('playVolumnArrow').className = 'playVolumnArrow';
break;
case 'playSound':
if (this.$('playSound').className == 'playNoSoundOver') {
this.$('playSound').className = 'playNoSound'
}
else if (this.$('playSound').className == 'playSoundOver') {
this.$('playSound').className = 'playSound'
}
break;
case 'playAdditem':
this.$('playAdditem').className = 'playAdditem';
break;
case 'playSetting':
this.$('playSetting').className = 'playSetting';
break;
case 'playFull':
this.$('playFull').className = 'playFull';
break;
case 'playFastFront':
this.$('playFastFront').className = 'playFastFront';
break;
case 'playNext':
this.$('playNext').className = 'playNext';
break;
case 'playPlay':
if (this.$('playPlay').className == 'playPlayPauseOver') {
this.$('playPlay').className = 'playPlayPause'
}
else if (this.$('playPlay').className == 'playPlayOver') {
this.$('playPlay').className = 'playPlay'
}
break;
case 'playPre':
this.$('playPre').className = 'playPre';
break;
case 'playFastBack':
this.$('playFastBack').className = 'playFastBack';
break;
case 'playStop':
this.$('playStop').className = 'playStop';
break;
default:
break;
}
};
/**
* @function: keycutbackHandler
* @description: 回切事件
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.keycutbackHandler = function () {
switch (this.moviePlayScreenMode) {
case ScreenMode.FULLSCREEN:
this.moviePlayScreenMode = ScreenMode.GENERAL;
this.$('playBar').style.display = '';
break;
case ScreenMode.GENERAL:
this.moviePlayScreenMode = ScreenMode.FULLSCREEN;
this.$('playBar').style.display = 'none';
break;
default:
break;
}
var scale = this.playScaleZoom(this.movieMediaPlayer.playWidth, this.movieMediaPlayer.playHeight, this.moviePlayScreenMode);
this.movieMediaPlayer.playScreenMode = this.moviePlayScreenMode;
this.movieMediaPlayer.playPointX = scale.pointx;
this.movieMediaPlayer.playPointY = scale.pointy;
this.movieMediaPlayer.playWidth = scale.width;
this.movieMediaPlayer.playHeight = scale.height;
this.movieMediaPlayer.setPosition();
};
/**
* @function: muteOn
* @description: 有声
* @author: shiying@dare-tech.com
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.muteOn = function () {
this.moviePlayMuteMode = MuteMode.ON;
this.movieMediaPlayer.playMuteMode = this.moviePlayMuteMode;
this.movieMediaPlayer.setMute();
},
/**
* @function: muteOff
* @description: 静音
* @author: shiying@dare-tech.com
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.muteOff = function () {
this.moviePlayMuteMode = MuteMode.OFF;
this.movieMediaPlayer.playMuteMode = this.moviePlayMuteMode;
this.movieMediaPlayer.setMute();
};
/**
* @function: keyenterHandler
* @description: 确定事件
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.keyenterHandler = function () {
switch (this.currentFocus) {
case 'playPlay':
this.moviePlayPause();
break;
case 'playSound':
if (this.$('playSound').className == 'playSoundOver') {
this.$('playSound').className = 'playNoSoundOver';
this.$('playVolumnStep').style.width = "0%";
this.muteOff();
}
else {
this.$('playSound').className = 'playSoundOver';
this.$('playVolumnStep').style.width = this.moviePlayVolume + '%';
this.muteOn();
}
break;
case 'playFull':
this.keycutbackHandler();
break;
case 'playFastFront':
this.moviePlayFastForward();
break;
case 'playFastBack':
this.moviePlayFastRewind();
break;
case 'playAdditem':
this.movieMediaPlayer.append();
window.location.href = new Dare.Business.Command().getListPage('movie') + '?append=true&pageIndex=' + this.pageIndex;
break;
case 'playVolumnArrow':
if (this.volumePressCount == 0) {
this.moviePlayVolumeUp();
if (this.moviePlayVolume == 100) {
this.volumePressCount = 1;
}
}
else {
this.moviePlayVolumeDown();
if (this.moviePlayVolume == 0) {
this.volumePressCount = 0;
}
}
if (this.moviePlayVolume > 0) {
this.muteOn();
}
else {
this.muteOff();
}
break;
case 'playNext':
this.moviePlayNext();
break;
case 'playPre':
this.moviePlayPrevious();
break;
case 'playStop': //停止/返回
this.movieStopBack();
break;
case 'playSetting':
this.movieMediaPlayer.append();
window.location.href = '../local/local.html?return=movieplay';
break;
case 'playArrow':
this.moviePlaySeek();
break;
default:
break;
}
};
/**
* @function: keyleftHandler
* @description: 向左事件
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.keyleftHandler = function () {
if (this.moviePlayScreenMode == ScreenMode.FULLSCREEN) {
this.clearFocusStatus();
this.$('playFastBack').className = 'playFastBackOver';
this.currentFocus = 'playFastBack';
this.moviePlayFastRewind();
}
else {
switch (this.currentFocus) {
case 'playVolumnArrow':
this.$('playVolumnArrow').className = 'playVolumnArrow';
if (this.$('playSound').className == 'playNoSound') {
this.$('playSound').className = 'playNoSoundOver';
}
else if (this.$('playSound').className == 'playSound') {
this.$('playSound').className = 'playSoundOver';
}
this.currentFocus = 'playSound';
break;
case 'playSound':
if (this.$('playSound').className == 'playNoSoundOver') {
this.$('playSound').className = 'playNoSound';
}
else if (this.$('playSound').className == 'playSoundOver') {
this.$('playSound').className = 'playSound';
}
this.$('playAdditem').className = 'playAdditemOver';
this.currentFocus = 'playAdditem';
break;
case 'playAdditem':
this.$('playAdditem').className = 'playAdditem';
this.$('playSetting').className = 'playSettingOver';
this.currentFocus = 'playSetting';
break;
case 'playSetting':
this.$('playSetting').className = 'playSetting';
this.$('playFull').className = 'playFullOver';
this.currentFocus = 'playFull';
break;
case 'playFull':
this.$('playFull').className = 'playFull';
this.$('playFastFront').className = 'playFastFrontOver';
this.currentFocus = 'playFastFront';
break;
case 'playFastFront':
this.$('playFastFront').className = 'playFastFront';
this.$('playNext').className = 'playNextOver';
this.currentFocus = 'playNext';
this.fastPressCount = 2;
break;
case 'playNext':
this.$('playNext').className = 'playNext';
if (this.$('playPlay').className == 'playPlayPause') {
this.$('playPlay').className = 'playPlayPauseOver';
}
else if (this.$('playPlay').className == 'playPlay') {
this.$('playPlay').className = 'playPlayOver';
}
this.currentFocus = 'playPlay';
break;
case 'playPlay':
if (this.$('playPlay').className == 'playPlayPauseOver') {
this.$('playPlay').className = 'playPlayPause';
}
else if (this.$('playPlay').className == 'playPlayOver') {
this.$('playPlay').className = 'playPlay';
}
this.$('playPre').className = 'playPreOver';
this.currentFocus = 'playPre';
break;
case 'playPre':
this.$('playPre').className = 'playPre';
this.$('playFastBack').className = 'playFastBackOver';
this.currentFocus = 'playFastBack';
break;
case 'playFastBack':
this.$('playFastBack').className = 'playFastBack';
this.$('playStop').className = 'playStopOver';
this.currentFocus = 'playStop';
this.fastPressCount = 2;
break;
case 'playArrow':
this.moviePlaySeekRewind();
break;
default:
break;
}
}
};
/**
* @function: keyrightHandler
* @description: 向右事件
* @param: null
* @return: null
*/
Dare.MoviePlay.prototype.keyrightHandler = function () {
if (this.moviePlayScreenMode == ScreenMode.FULLSCREEN) {
this.clearFocusStatus();
this.$('playFastFront').className = 'playFastFrontOver';
this.currentFocus = 'playFastFront';
this.moviePlayFastForward();
}
else {
switch (this.currentFocus) {
case 'playStop':
this.$('playStop').className = 'playStop';
this.$('playFastBack').className = 'playFastBackOver';
this.currentFocus = 'playFastBack';
break;
case 'playFastBack':
this.$('playFastBack').className = 'playFastBack';
this.$('playPre').className = 'playPreOver';
this.currentFocus = 'playPre';
this.fastPressCount = 2;
break;
case 'playPre':
this.$('playPre').className = 'playPre';
if (this.$('playPlay').className == 'playPlayPause') {
this.$('playPlay').className = 'playPlayPauseOver';
}
else if (this.$('playPlay').className == 'playPlay') {
this.$('playPlay').className = 'playPlayOver';
}
this.currentFocus = 'playPlay';
break;
case 'playPlay':
if (this.$('playPlay').className == 'playPlayPauseOver') {
this.$('playPlay').className = 'playPlayPause';
}
else if (this.$('playPlay').className == 'playPlayOver') {
this.$('playPlay').className = 'playPlay';
}
this.$('playNext').className = 'playNextOver';
this.currentFocus = 'playNext';
break;
case 'playNext':
this.$('playNext').className = 'playNext';
this.$('playFastFront').className = 'playFastFrontOver';
this.currentFocus = 'playFastFront';
break;
case 'playFastFront':
this.$('playFastFront').className = 'playFastFront';
this.$('playFull').className = 'playFullOver';
this.currentFocus = 'playFull';
this.fastPressCount = 2;
break;
case 'playFull':
this.$('playFull').className = 'playFull';
this.$('playSetting').className = 'playSettingOver';
this.currentFocus = 'playSetting';
break;
case 'playSetting':
this.$('playSetting').className = 'playSetting';
this.$('playAdditem').className = 'playAdditemOver';
this.currentFocus = 'playAdditem';
break;
case 'playAdditem':
this.$('playAdditem').className = 'playAdditem';
if (this.$('playSound').className == 'playNoSound') {
this.$('playSound').className = 'playNoSoundOver';
}
else if (this.$('playSound').className == 'playSound') {
this.$('playSound').className = 'playSoundOver';
}
this.currentFocus = 'playSound';
break;
case 'playSound':
if (this.$('playSound').className == 'playNoSoundOver') {
this.$('playSound').className = 'playNoSound';
}
else if (this.$('playSound').className == 'playSoundOver') {
this.$('playSound').className = 'playSound';
}
this.$('playVolumnArrow').className = 'playVolumnArrowOver';
this.currentFocus = 'playVolumnArrow';
break;
case 'playArrow':
this.moviePlaySeekForward();
break;
default:
break;
}
}
};
var dareMoviePlay = new Dare.MoviePlay();
document.onkeypress = function (event) {
dareMoviePlay.keypressHandler(event);
};