Commit 80fa9d01 by Valera Rozuvan

Added support for time line in HTML5.

parent 067f2e97
......@@ -113,50 +113,34 @@ this.HTML5Video = (function () {
this.video = this.videoEl[0];
this.video.addEventListener('canplay', function () {
console.log('We got a "canplay" event.');
_this.playerState = HTML5Video.PlayerState.PAUSED;
if ($.isFunction(_this.config.events.onReady) === true) {
console.log('Callback function "onReady" is defined.');
_this.config.events.onReady({});
}
}, false);
this.video.addEventListener('play', function () {
console.log('We got a "play" event.');
_this.playerState = HTML5Video.PlayerState.PLAYING;
if ($.isFunction(_this.config.events.onStateChange) === true) {
console.log('Callback function "onStateChange" is defined.');
_this.config.events.onStateChange({
'data': _this.playerState
});
}
}, false);
this.video.addEventListener('pause', function () {
console.log('We got a "pause" event.');
_this.playerState = HTML5Video.PlayerState.PAUSED;
if ($.isFunction(_this.config.events.onStateChange) === true) {
console.log('Callback function "onStateChange" is defined.');
_this.config.events.onStateChange({
'data': _this.playerState
});
}
}, false);
this.video.addEventListener('ended', function () {
console.log('We got a "ended" event.');
_this.playerState = HTML5Video.PlayerState.ENDED;
if ($.isFunction(_this.config.events.onStateChange) === true) {
console.log('Callback function "onStateChange" is defined.');
_this.config.events.onStateChange({
'data': _this.playerState
});
......@@ -201,7 +185,6 @@ this.HTML5Video = (function () {
};
Player.prototype.pauseVideo = function () {
console.log('Player.prototype.pauseVideo');
this.video.pause();
};
......@@ -237,12 +220,10 @@ this.HTML5Video = (function () {
};
Player.prototype.getCurrentTime = function () {
return this.video.currentTime;
};
Player.prototype.playVideo = function () {
console.log('Player.prototype.playVideo');
this.video.play();
};
......@@ -255,9 +236,7 @@ this.HTML5Video = (function () {
};
Player.prototype.getDuration = function () {
// TODO: Return valid video duration.
return 0;
return this.video.duration;
};
return Player;
......
......@@ -171,22 +171,19 @@ class @VideoPlayerAlpha extends SubviewAlpha
# Delegates
play: =>
console.log 'Play clicked'
console.log @player.playVideo
@player.playVideo() if @player.playVideo
isPlaying: ->
@player.getPlayerState() == @PlayerState.PLAYING
pause: =>
console.log 'Pause clicked'
console.log @player.pauseVideo
@player.pauseVideo() if @player.pauseVideo
duration: ->
if @video.videoType is "youtube"
return @video.getDuration()
else return @player.getDuration() if @video.videoType is "html5"
else if @video.videoType is "html5"
return @player.getDuration()
0
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