Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
strip debug/console statements from build. added a stop() method to t…
Browse files Browse the repository at this point in the history
…he player that stops the video and terminates the worker.
  • Loading branch information
Andrew Cross authored and Andrew Cross committed Mar 19, 2015
1 parent ec31104 commit 239a723
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions dist/hlsplayer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var rename = require("gulp-rename");
var umd = require("gulp-umd");
var server = require("gulp-server-livereload");
var fileInsert = require("gulp-file-insert");
var stripDebug = require('gulp-strip-debug');
var requirejs = require('requirejs');

gulp.task("build", function(){
Expand All @@ -26,6 +27,7 @@ gulp.task("build", function(){
"/* WORKER_SOURCE_GOES_HERE */": config.out,
}))
.pipe(rename("hlsplayer.js"))
.pipe(stripDebug())
.pipe(umd({
exports: function(file) { return "HLSPlayer" },
namespace: function(file) { return "HLSPlayer" }
Expand Down
1 change: 1 addition & 0 deletions index-lib.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<div>
<button onclick="canvas.play()">Play</button>
<button onclick="canvas.pause()">Pause</button>
<button onclick="canvas.stop()">Stop</button>
</div>

<script type="text/javascript">
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"gulp-server-livereload": "~1.2.1",
"gulp-rename": "~1.2.0",
"requirejs": "~2.1.16",
"gulp-umd": "~0.1.3"
"gulp-umd": "~0.1.3",
"gulp-strip-debug": "~1.0.2"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions worker-lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function HLSPlayer(canvas, manifestUrl, options) {

canvas.play = function() { if(currentVideo) currentVideo.play(); };
canvas.pause = function() { if(currentVideo) currentVideo.pause(); };
canvas.stop = function() {
if(currentVideo) currentVideo.pause();
worker.terminate();
worker = null;
}

// drawing new frame
function nextFrame() {
Expand Down

0 comments on commit 239a723

Please sign in to comment.