Commit 80fa9d01 by Valera Rozuvan

Added support for time line in HTML5.

parent 067f2e97
...@@ -113,50 +113,34 @@ this.HTML5Video = (function () { ...@@ -113,50 +113,34 @@ this.HTML5Video = (function () {
this.video = this.videoEl[0]; this.video = this.videoEl[0];
this.video.addEventListener('canplay', function () { this.video.addEventListener('canplay', function () {
console.log('We got a "canplay" event.');
_this.playerState = HTML5Video.PlayerState.PAUSED; _this.playerState = HTML5Video.PlayerState.PAUSED;
if ($.isFunction(_this.config.events.onReady) === true) { if ($.isFunction(_this.config.events.onReady) === true) {
console.log('Callback function "onReady" is defined.');
_this.config.events.onReady({}); _this.config.events.onReady({});
} }
}, false); }, false);
this.video.addEventListener('play', function () { this.video.addEventListener('play', function () {
console.log('We got a "play" event.');
_this.playerState = HTML5Video.PlayerState.PLAYING; _this.playerState = HTML5Video.PlayerState.PLAYING;
if ($.isFunction(_this.config.events.onStateChange) === true) { if ($.isFunction(_this.config.events.onStateChange) === true) {
console.log('Callback function "onStateChange" is defined.');
_this.config.events.onStateChange({ _this.config.events.onStateChange({
'data': _this.playerState 'data': _this.playerState
}); });
} }
}, false); }, false);
this.video.addEventListener('pause', function () { this.video.addEventListener('pause', function () {
console.log('We got a "pause" event.');
_this.playerState = HTML5Video.PlayerState.PAUSED; _this.playerState = HTML5Video.PlayerState.PAUSED;
if ($.isFunction(_this.config.events.onStateChange) === true) { if ($.isFunction(_this.config.events.onStateChange) === true) {
console.log('Callback function "onStateChange" is defined.');
_this.config.events.onStateChange({ _this.config.events.onStateChange({
'data': _this.playerState 'data': _this.playerState
}); });
} }
}, false); }, false);
this.video.addEventListener('ended', function () { this.video.addEventListener('ended', function () {
console.log('We got a "ended" event.');
_this.playerState = HTML5Video.PlayerState.ENDED; _this.playerState = HTML5Video.PlayerState.ENDED;
if ($.isFunction(_this.config.events.onStateChange) === true) { if ($.isFunction(_this.config.events.onStateChange) === true) {
console.log('Callback function "onStateChange" is defined.');
_this.config.events.onStateChange({ _this.config.events.onStateChange({
'data': _this.playerState 'data': _this.playerState
}); });
...@@ -201,7 +185,6 @@ this.HTML5Video = (function () { ...@@ -201,7 +185,6 @@ this.HTML5Video = (function () {
}; };
Player.prototype.pauseVideo = function () { Player.prototype.pauseVideo = function () {
console.log('Player.prototype.pauseVideo');
this.video.pause(); this.video.pause();
}; };
...@@ -237,12 +220,10 @@ this.HTML5Video = (function () { ...@@ -237,12 +220,10 @@ this.HTML5Video = (function () {
}; };
Player.prototype.getCurrentTime = function () { Player.prototype.getCurrentTime = function () {
return this.video.currentTime;
}; };
Player.prototype.playVideo = function () { Player.prototype.playVideo = function () {
console.log('Player.prototype.playVideo');
this.video.play(); this.video.play();
}; };
...@@ -255,9 +236,7 @@ this.HTML5Video = (function () { ...@@ -255,9 +236,7 @@ this.HTML5Video = (function () {
}; };
Player.prototype.getDuration = function () { Player.prototype.getDuration = function () {
// TODO: Return valid video duration. return this.video.duration;
return 0;
}; };
return Player; return Player;
......
...@@ -171,22 +171,19 @@ class @VideoPlayerAlpha extends SubviewAlpha ...@@ -171,22 +171,19 @@ class @VideoPlayerAlpha extends SubviewAlpha
# Delegates # Delegates
play: => play: =>
console.log 'Play clicked'
console.log @player.playVideo
@player.playVideo() if @player.playVideo @player.playVideo() if @player.playVideo
isPlaying: -> isPlaying: ->
@player.getPlayerState() == @PlayerState.PLAYING @player.getPlayerState() == @PlayerState.PLAYING
pause: => pause: =>
console.log 'Pause clicked'
console.log @player.pauseVideo
@player.pauseVideo() if @player.pauseVideo @player.pauseVideo() if @player.pauseVideo
duration: -> duration: ->
if @video.videoType is "youtube" if @video.videoType is "youtube"
return @video.getDuration() return @video.getDuration()
else return @player.getDuration() if @video.videoType is "html5" else if @video.videoType is "html5"
return @player.getDuration()
0 0
currentSpeed: -> currentSpeed: ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment