Explorar el Código

Merge pull request #106 from rasmusvhansen/patch-1

Dominic Szablewski hace 9 años
padre
commit
6a32d86c4e
Se han modificado 2 ficheros con 4 adiciones y 1 borrados
  1. 1 0
      README.md
  2. 3 1
      jsmpg.js

+ 1 - 0
README.md Ver fichero

@@ -26,6 +26,7 @@ The `options` argument to the `jsmpeg()` supports the following properties:
26 26
 - `autoplay` whether playback should start automatically after loading
27 27
 - `loop` whether playback is looped
28 28
 - `seekable` whether a seek-index is build during load time; neccessary for `seekToFrame` and `seekToTime` methods
29
+- `progressiveThrottled` whether to throttle downloading chunks until they're needed for playback. Requires `progressive`; default `false`.
29 30
 - `onload` a function that's called once, after the .mpg file has been completely loaded
30 31
 - `ondecodeframe` a function that's called after every frame that's decoded and rendered to the canvas
31 32
 - `onfinished` a function that's called when playback ends

+ 3 - 1
jsmpg.js Ver fichero

@@ -8,6 +8,7 @@ var jsmpeg = window.jsmpeg = function(url, opts) {
8 8
 	this.wantsToPlay = this.autoplay;
9 9
 	this.loop = !!opts.loop;
10 10
 	this.seekable = !!opts.seekable;
11
+	this.preserveDrawingBuffer = !!opts.preserveDrawingBuffer;
11 12
 	this.externalLoadCallback = opts.onload || null;
12 13
 	this.externalDecodeCallback = opts.ondecodeframe || null;
13 14
 	this.externalFinishedCallback = opts.onfinished || null;
@@ -1008,7 +1009,8 @@ jsmpeg.prototype.initWebGL = function() {
1008 1009
 
1009 1010
 	// attempt to get a webgl context
1010 1011
 	try {
1011
-		gl = this.gl = this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl');
1012
+		var options = { preserveDrawingBuffer: this.preserveDrawingBuffer };
1013
+		gl = this.gl = this.canvas.getContext('webgl', options) || this.canvas.getContext('experimental-webgl', options);
1012 1014
 	} catch (e) {
1013 1015
 		return false;
1014 1016
 	}