media-sequence
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "media-sequence", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/oncletom/media-sequence", | ||
@@ -8,3 +8,3 @@ "authors": [ | ||
], | ||
"description": "Manual and automatic HTML5 media sequenced playback. And plain JavaScript, no library required.", | ||
"description": "HTML5 media sequenced playback API: play one or multiple sequences of a same audio or video with plain JavaScript.", | ||
"main": "index.js", | ||
@@ -11,0 +11,0 @@ "moduleType": [ |
@@ -20,2 +20,6 @@ 'use strict'; | ||
this.scheduler = null; | ||
this.mediaElement.addEventListener('timeupdate', this.runScheduler.bind(this)); | ||
this.sequences = []; | ||
@@ -98,2 +102,6 @@ | ||
MediaSequence.prototype.runScheduler = function runScheduler(event){ | ||
return this.scheduler && this.scheduler.call(this.scheduler, event); | ||
}; | ||
/** | ||
@@ -111,3 +119,3 @@ * | ||
var scheduler = new Scheduler(firstSequence, function onTimeupdate(currentTime){ | ||
this.scheduler = new Scheduler(firstSequence, function onTimeupdate(currentTime){ | ||
// the current sequence is not over yet, skip the beat. | ||
@@ -131,3 +139,3 @@ if (currentTime < this.getSequence().end) { | ||
selfie.emit('playall.postpone', nextSequence); | ||
scheduler.postponeToSequenceEnd(nextSequence); | ||
this.postponeToSequenceEnd(nextSequence); | ||
return; | ||
@@ -139,8 +147,6 @@ } | ||
selfie.emit('playall.sequence', nextSequence); | ||
scheduler.postponeToSequenceStart(nextSequence); | ||
this.postponeToSequenceStart(nextSequence); | ||
selfie.seek(nextSequence.start); | ||
}); | ||
this.mediaElement.addEventListener('timeupdate', scheduler.bind(scheduler)); | ||
this.seek(firstSequence.start); | ||
@@ -173,3 +179,3 @@ return this.play(); | ||
var scheduler = new Scheduler(endTime, function onTimeupdate(currentTime){ | ||
this.scheduler = new Scheduler(endTime, function onTimeupdate(currentTime){ | ||
if (currentTime >= this.getEndTime()) { | ||
@@ -185,4 +191,2 @@ selfie.pause(); | ||
this.mediaElement.addEventListener('timeupdate', scheduler.bind(scheduler)); | ||
return this.play(); | ||
@@ -201,3 +205,11 @@ }; | ||
if (nextSequence) { | ||
this.playFrom(nextSequence.start, nextSequence.end); | ||
if (this.scheduler) { | ||
this.emit('playnext.sequence', nextSequence); | ||
this.scheduler.postponeToSequenceEnd(nextSequence); | ||
this.seek(nextSequence.start); | ||
this.play(); | ||
} | ||
else { | ||
this.playFrom(nextSequence.start, nextSequence.end); | ||
} | ||
} | ||
@@ -204,0 +216,0 @@ |
@@ -17,3 +17,3 @@ 'use strict'; | ||
if (result === true){ | ||
event.target.removeEventListener('timeupdate', this); | ||
onTimeupdate = function(){}; | ||
} | ||
@@ -20,0 +20,0 @@ }; |
{ | ||
"name": "media-sequence", | ||
"version": "0.1.0", | ||
"description": "Manual and automatic HTML5 media sequenced playback. And plain JavaScript, no library required.", | ||
"version": "0.1.1", | ||
"description": "HTML5 media sequenced playback API: play one or multiple sequences of a same audio or video with plain JavaScript.", | ||
"main": "./index.js", | ||
@@ -33,3 +33,3 @@ "scripts": { | ||
"chai": "^1.9.1", | ||
"karma": "git+https://github.com/karma-runner/karma.git#c071305b08f0dcb3cac1b9a04e6feefbbde13882", | ||
"karma": "^0.12.16", | ||
"karma-bro": "^0.5.0", | ||
@@ -36,0 +36,0 @@ "karma-chai": "^0.1.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
100987
23
480
3
2