2015-04-21 14:25:36 +00:00
|
|
|
function Player() {
|
|
|
|
this.supportsOverlay = false;
|
|
|
|
this.muted = false;
|
|
|
|
}
|
|
|
|
Player.prototype.init = function(elemID) {
|
|
|
|
//make overlay settings happy..., add a dummy element
|
|
|
|
this.player = document.getElementById(elemID);
|
|
|
|
}
|
|
|
|
Player.prototype.play = function() { }
|
|
|
|
Player.prototype.pause = function() { }
|
|
|
|
Player.prototype.get = function() { }
|
|
|
|
Player.prototype.listener = function() { }
|
|
|
|
Player.prototype.set = function(pos) { }
|
|
|
|
Player.prototype.mute = 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);
|
|
|
|
}
|
|
|
|
|
|
|
|
Player.prototype.seekBack = function(ms) {
|
|
|
|
var currentMs = this.get();
|
|
|
|
var newMs = currentMs - ms;
|
|
|
|
this.set(newMs);
|
|
|
|
}
|
|
|
|
|
|
|
|
Player.prototype.unmute = function(pos) { }
|
|
|
|
/* Player.prototype.url = function(pos) {
|
|
|
|
var timecode = pos2npt(pos);
|
|
|
|
var link = video.url;
|
|
|
|
if(pos > 0)
|
|
|
|
link += "?t=npt:" + timecode;
|
|
|
|
return link;
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
|
|
|
function VideoPlayer() {
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.set = function(pos) {
|
|
|
|
/* var url = this.url(pos);
|
|
|
|
var autoplay = 'true';
|
|
|
|
if(this.isPlaying)
|
|
|
|
varautoplay = 'true';
|
|
|
|
if(this.player) {
|
|
|
|
var element = $(this.player);
|
|
|
|
this.player.pause();
|
|
|
|
} else {
|
|
|
|
var element = $('#' + playerID);
|
|
|
|
}
|
|
|
|
this.player = document.createElement('video');
|
|
|
|
this.player.id = playerID;
|
|
|
|
this.player.width = this.width;
|
|
|
|
this.player.height = this.height;
|
|
|
|
this.player.setAttribute('src', url);
|
|
|
|
//this.player.setAttribute('autoplay', autoplay);
|
|
|
|
element.replaceWith(this.player); */
|
2016-02-29 09:36:39 +00:00
|
|
|
this.player.currentTime = pos;
|
2015-04-21 14:25:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VideoPlayer.prototype.get = function() {
|
|
|
|
try {
|
2016-02-29 09:36:39 +00:00
|
|
|
return this.player.currentTime;
|
2015-04-21 14:25:36 +00:00
|
|
|
} catch(err) { }
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.play = function() {
|
|
|
|
this.isPlaying = true;
|
|
|
|
this.player.play();
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.pause = function() {
|
|
|
|
this.isPlaying = false;
|
|
|
|
this.player.pause();
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.mute = function(pos) {
|
|
|
|
this.player.muted = true;
|
|
|
|
this.muted = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.unmute = function(pos) {
|
|
|
|
this.player.muted = false;
|
|
|
|
this.muted = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.togglePause = function() {
|
|
|
|
if (Video.isPlaying == true) {
|
|
|
|
Video.pause();
|
|
|
|
} else {
|
|
|
|
Video.play();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
VideoPlayer.prototype.listener = function() {
|
2016-02-29 09:36:39 +00:00
|
|
|
var t = Video.get();
|
2016-02-29 11:56:25 +00:00
|
|
|
var npt = Ox.formatDuration(t, 3);
|
2015-04-21 14:25:36 +00:00
|
|
|
$('#timeCode').html(npt);
|
2016-02-29 09:36:39 +00:00
|
|
|
var seekBarPos = parseInt((t/Video.duration) * 320);
|
2015-04-21 14:25:36 +00:00
|
|
|
$('#seekPointer').css("left", seekBarPos + "px");
|
2016-02-29 11:56:25 +00:00
|
|
|
}
|
2015-04-21 14:25:36 +00:00
|
|
|
|
|
|
|
VideoPlayer.prototype.setDuration = function(duration) {
|
|
|
|
this.duration = duration;
|
2016-02-29 11:56:25 +00:00
|
|
|
}
|