diff --git a/README.md b/README.md index cf3ee00e..031cd291 100755 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ The `options` argument to the `jsmpeg()` supports the following properties: - `autoplay` whether playback should start automatically after loading - `loop` whether playback is looped - `seekable` whether a seek-index is build during load time; neccessary for `seekToFrame` and `seekToTime` methods +- `progressiveThrottled` whether to throttle downloading chunks until they're needed for playback. Requires `progressive`; default `false`. - `onload` a function that's called once, after the .mpg file has been completely loaded - `ondecodeframe` a function that's called after every frame that's decoded and rendered to the canvas - `onfinished` a function that's called when playback ends diff --git a/jsmpg.js b/jsmpg.js index dcc27224..71968c51 100755 --- a/jsmpg.js +++ b/jsmpg.js @@ -8,6 +8,7 @@ var jsmpeg = window.jsmpeg = function(url, opts) { this.wantsToPlay = this.autoplay; this.loop = !!opts.loop; this.seekable = !!opts.seekable; + this.preserveDrawingBuffer = !!opts.preserveDrawingBuffer; this.externalLoadCallback = opts.onload || null; this.externalDecodeCallback = opts.ondecodeframe || null; this.externalFinishedCallback = opts.onfinished || null; @@ -1008,7 +1009,8 @@ jsmpeg.prototype.initWebGL = function() { // attempt to get a webgl context try { - gl = this.gl = this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl'); + var options = { preserveDrawingBuffer: this.preserveDrawingBuffer }; + gl = this.gl = this.canvas.getContext('webgl', options) || this.canvas.getContext('experimental-webgl', options); } catch (e) { return false; }