videocontext
Advanced tools
Comparing version 0.17.0 to 0.18.0
{ | ||
"name": "videocontext", | ||
"version": "0.17.0", | ||
"version": "0.18.0", | ||
"description": "A WebGL & HTML5 graph based video composition library", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -378,2 +378,4 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
if (currentTime > playlistDuration && !videoContext.endOnLastSourceEnd) playlistDuration = currentTime; | ||
if (videoContext.duration === Infinity){ | ||
@@ -380,0 +382,0 @@ let total = 0; |
@@ -45,5 +45,13 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
*/ | ||
constructor(canvas, initErrorCallback){ | ||
constructor(canvas, initErrorCallback, options={"preserveDrawingBuffer":true, "manualUpdate":false, "endOnLastSourceEnd":true}){ | ||
this._canvas = canvas; | ||
this._gl = canvas.getContext("experimental-webgl", { preserveDrawingBuffer: true, alpha: false }); | ||
let manualUpdate = false; | ||
let preserveDrawingBuffer = true; | ||
this.endOnLastSourceEnd = true; | ||
if ("manualUpdate" in options) manualUpdate = options.manualUpdate; | ||
if ("preserveDrawingBuffer" in options) preserveDrawingBuffer = options.preserveDrawingBuffer; | ||
if ("endOnLastSourceEnd" in options) this.endOnLastSourceEnd = options.endOnLastSourceEnd; | ||
this._gl = canvas.getContext("experimental-webgl", { preserveDrawingBuffer: preserveDrawingBuffer, alpha: false }); | ||
if(this._gl === null){ | ||
@@ -55,3 +63,2 @@ console.error("Failed to intialise WebGL."); | ||
this.endOnLastSourceEnd = true; | ||
@@ -74,3 +81,5 @@ this._renderGraph = new RenderGraph(); | ||
registerUpdateable(this); | ||
if(!manualUpdate){ | ||
registerUpdateable(this); | ||
} | ||
} | ||
@@ -591,2 +600,28 @@ | ||
/** | ||
* This allows manual calling of the update loop of the videoContext. | ||
* | ||
* @param {Number} dt - The difference in seconds between this and the previous calling of update. | ||
* @example | ||
* | ||
* var canvasElement = document.getElemenyById("canvas"); | ||
* var ctx = new VideoContext(canvasElement, undefined, {"manualUpdate" : true}); | ||
* | ||
* var previousTime; | ||
* function update(time){ | ||
* if (previousTime === undefined) previousTime = time; | ||
* var dt = (time - previousTime)/1000; | ||
* ctx.update(dt); | ||
* previousTime = time; | ||
* requestAnimationFrame(update); | ||
* } | ||
* update(); | ||
* | ||
*/ | ||
update(dt){ | ||
this._update(dt); | ||
} | ||
_update(dt){ | ||
@@ -593,0 +628,0 @@ if (this._state === VideoContext.STATE.PLAYING || this._state === VideoContext.STATE.STALLED || this._state === VideoContext.STATE.PAUSED) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2042976
11489