Skip to content

Commit

Permalink
Merge pull request phoboslab#106 from rasmusvhansen/patch-1
Browse files Browse the repository at this point in the history
Fix canvas.toDataURL yielding blank image.
  • Loading branch information
phoboslab authored Jan 9, 2017
2 parents 5b0e595 + 2b94fdc commit 6a32d86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion jsmpg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 6a32d86

Please sign in to comment.