This commit is contained in:
j 2016-02-29 17:44:01 +05:30
parent 17a74231aa
commit 030aaeb910
1 changed files with 41 additions and 41 deletions

View File

@ -1,9 +1,9 @@
function Player() {
this.supportsOverlay = false;
this.supportsOverlay = false;
}
Player.prototype.init = function(elemID) {
//make overlay settings happy..., add a dummy element
this.player = document.getElementById(elemID);
//make overlay settings happy..., add a dummy element
this.player = document.getElementById(elemID);
}
Player.prototype.play = function() { }
Player.prototype.pause = function() { }
@ -13,78 +13,78 @@ Player.prototype.set = function(pos) { }
Player.prototype.volUp = function() { }
Player.prototype.volDown = function() { }
Player.prototype.seekFwd = function(ms) {
var currentMs = this.get();
var newMs = currentMs + ms;
this.set(newMs);
}
var currentMs = this.get();
var newMs = currentMs + ms;
this.set(newMs);
}
Player.prototype.seekBack = function(ms) {
var currentMs = this.get();
var newMs = currentMs - ms;
this.set(newMs);
}
var currentMs = this.get();
var newMs = currentMs - ms;
this.set(newMs);
}
function VideoPlayer() {
this.supportsOverlay = true;
this.isPlaying = false;
this.supportsOverlay = true;
this.isPlaying = false;
}
VideoPlayer.prototype = new Player();
VideoPlayer.prototype.init = function(elemID) {
this.player = document.getElementById(elemID);
this.width = $(this.player).attr('width');
this.height = $(this.player).attr('height');
this.player = document.getElementById(elemID);
this.width = $(this.player).attr('width');
this.height = $(this.player).attr('height');
}
VideoPlayer.prototype.volUp = function() {
var vol = this.player.volume;
if (vol <= 0.9) { var newVol = vol + 0.1 } else { return false; }
this.player.volume = newVol;
return true;
}
var vol = this.player.volume;
if (vol <= 0.9) { var newVol = vol + 0.1 } else { return false; }
this.player.volume = newVol;
return true;
}
VideoPlayer.prototype.volDown = function() {
var vol = this.player.volume;
if (vol >= 0.1) { var newVol = vol - 0.1 } else { return false; }
this.player.volume = newVol;
return true;
}
var vol = this.player.volume;
if (vol >= 0.1) { var newVol = vol - 0.1 } else { return false; }
this.player.volume = newVol;
return true;
}
VideoPlayer.prototype.set = function(pos) {
this.player.currentTime = pos;
this.player.currentTime = pos;
}
VideoPlayer.prototype.get = function() {
try {
return this.player.currentTime;
} catch(err) { }
return -1;
try {
return this.player.currentTime;
} catch(err) { }
return -1;
}
VideoPlayer.prototype.play = function() {
this.isPlaying = true;
this.player.play();
this.isPlaying = true;
this.player.play();
}
VideoPlayer.prototype.pause = function() {
this.isPlaying = false;
this.player.pause();
this.isPlaying = false;
this.player.pause();
}
VideoPlayer.prototype.togglePause = function() {
if (Video.isPlaying == true) {
Video.pause();
if (Video.isPlaying == true) {
Video.pause();
} else {
Video.play();
Video.play();
}
}
}
VideoPlayer.prototype.listener = function() {
$('#timeCode').html(Ox.formatDuration(Video.get(), 3));
$('#timeCode').html(Ox.formatDuration(Video.get(), 3));
}
VideoPlayer.prototype.setDuration = function(duration) {
this.duration = duration;
this.duration = duration;
}