Skip to content

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Elecash committed Oct 17, 2015
1 parent 9ae581d commit eade2eb
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "videogular",
"version": "1.2.8",
"version": "1.3.0",
"main": "./videogular.js",
"dependencies": {
"angular": "^1.3.x",
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require('angularj');
require('angular-sanitize');
require('./videogular');

module.exports = 'com.2fdevs.videogular';
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "videogular",
"version": "1.2.8",
"dependencies": {},
"version": "1.3.0",
"main": "index.js",
"dependencies": {
"angular": "~1.3.0",
"angular-sanitize": "~1.3.0"
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-release": "~0.7.0"
},
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "grunt test"
}
}
29 changes: 24 additions & 5 deletions videogular.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license videogular v1.2.8 http://videogular.com
* @license videogular v1.3.0 http://videogular.com
* Two Fucking Developers http://twofuckingdevelopers.com
* License: MIT
*/
Expand Down Expand Up @@ -129,6 +129,8 @@ angular.module("com.2fdevs.videogular")
* - timeLeft: Number value with current media time left.
* - volume: Number value with current volume between 0 and 1.
* - playback: Number value with current playback between 0 and 2.
* - bufferEnd: Number value with latest buffer point in milliseconds.
* - buffered: Array of TimeRanges objects that represents current buffer state.
*
*/
angular.module("com.2fdevs.videogular")
Expand Down Expand Up @@ -201,9 +203,23 @@ angular.module("com.2fdevs.videogular")
this.onUpdateTime(evt);
};

this.onProgress = function (event) {
if (event.target.buffered.length) {
this.buffered = event.target.buffered;
this.bufferEnd = 1000 * event.target.buffered.end(event.target.buffered.length - 1);
}

$scope.$apply();
};

this.onUpdateTime = function (event) {
this.currentTime = 1000 * event.target.currentTime;

if (event.target.buffered.length) {
this.buffered = event.target.buffered;
this.bufferEnd = 1000 * event.target.buffered.end(event.target.buffered.length - 1);
}

if (event.target.duration != Infinity) {
this.totalTime = 1000 * event.target.duration;
this.timeLeft = 1000 * (event.target.duration - event.target.currentTime);
Expand Down Expand Up @@ -252,8 +268,6 @@ angular.module("com.2fdevs.videogular")
if (!cp.$$isDirty && (typeof cp.onEnter === 'function')) {
cp.onEnter(currentTime, cp.timeLapse, cp.params);
}

cp.$$isDirty = true;
}

// We've been passed the cue point
Expand All @@ -262,9 +276,9 @@ angular.module("com.2fdevs.videogular")
cp.$$isCompleted = true;
cp.onComplete(currentTime, cp.timeLapse, cp.params);
}

cp.$$isDirty = false;
}

cp.$$isDirty = true;
}
else {
if (cp.onLeave && cp.$$isDirty) {
Expand Down Expand Up @@ -360,6 +374,8 @@ angular.module("com.2fdevs.videogular")
this.mediaElement[0].currentTime = 0;

this.currentTime = 0;
this.buffered = [];
this.bufferEnd = 0;
this.setState(VG_STATES.STOP);
}
catch (e) {
Expand Down Expand Up @@ -509,6 +525,7 @@ angular.module("com.2fdevs.videogular")
this.mediaElement[0].addEventListener("volumechange", this.onVolumeChange.bind(this), false);
this.mediaElement[0].addEventListener("playbackchange", this.onPlaybackChange.bind(this), false);
this.mediaElement[0].addEventListener("timeupdate", this.onUpdateTime.bind(this), false);
this.mediaElement[0].addEventListener("progress", this.onProgress.bind(this), false);
this.mediaElement[0].addEventListener("seeking", this.onSeeking.bind(this), false);
this.mediaElement[0].addEventListener("seeked", this.onSeeked.bind(this), false);
this.mediaElement[0].addEventListener("error", this.onVideoError.bind(this), false);
Expand All @@ -517,6 +534,8 @@ angular.module("com.2fdevs.videogular")
this.init = function () {
this.isReady = false;
this.isCompleted = false;
this.buffered = [];
this.bufferEnd = 0;
this.currentTime = 0;
this.totalTime = 0;
this.timeLeft = 0;
Expand Down
Loading

0 comments on commit eade2eb

Please sign in to comment.