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); */ this.player.currentTime = pos / 1000; } VideoPlayer.prototype.get = function() { try { return parseInt(this.player.currentTime * 1000); } 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() { var ms = Video.get(); var npt = ms2npt(ms); $('#timeCode').html(npt); var seekBarPos = parseInt((ms / (Video.duration * 1000)) * 320); $('#seekPointer').css("left", seekBarPos + "px"); } VideoPlayer.prototype.setDuration = function(duration) { this.duration = duration; }