Przeglądaj źródła

Merge pull request #106 from rasmusvhansen/patch-1

Dominic Szablewski 9 lat temu
rodzic
commit
6a32d86c4e
2 zmienionych plików z 4 dodań i 1 usunięć
  1. 1 0
      README.md
  2. 3 1
      jsmpg.js

+ 1 - 0
README.md Wyświetl plik

26
 - `autoplay` whether playback should start automatically after loading
26
 - `autoplay` whether playback should start automatically after loading
27
 - `loop` whether playback is looped
27
 - `loop` whether playback is looped
28
 - `seekable` whether a seek-index is build during load time; neccessary for `seekToFrame` and `seekToTime` methods
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
 - `onload` a function that's called once, after the .mpg file has been completely loaded
30
 - `onload` a function that's called once, after the .mpg file has been completely loaded
30
 - `ondecodeframe` a function that's called after every frame that's decoded and rendered to the canvas
31
 - `ondecodeframe` a function that's called after every frame that's decoded and rendered to the canvas
31
 - `onfinished` a function that's called when playback ends
32
 - `onfinished` a function that's called when playback ends

+ 3 - 1
jsmpg.js Wyświetl plik

8
 	this.wantsToPlay = this.autoplay;
8
 	this.wantsToPlay = this.autoplay;
9
 	this.loop = !!opts.loop;
9
 	this.loop = !!opts.loop;
10
 	this.seekable = !!opts.seekable;
10
 	this.seekable = !!opts.seekable;
11
+	this.preserveDrawingBuffer = !!opts.preserveDrawingBuffer;
11
 	this.externalLoadCallback = opts.onload || null;
12
 	this.externalLoadCallback = opts.onload || null;
12
 	this.externalDecodeCallback = opts.ondecodeframe || null;
13
 	this.externalDecodeCallback = opts.ondecodeframe || null;
13
 	this.externalFinishedCallback = opts.onfinished || null;
14
 	this.externalFinishedCallback = opts.onfinished || null;
1008
 
1009
 
1009
 	// attempt to get a webgl context
1010
 	// attempt to get a webgl context
1010
 	try {
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
 	} catch (e) {
1014
 	} catch (e) {
1013
 		return false;
1015
 		return false;
1014
 	}
1016
 	}