videocontext
Advanced tools
Comparing version 0.34.4 to 0.35.0
{ | ||
"name": "videocontext", | ||
"version": "0.34.4", | ||
"version": "0.35.0", | ||
"description": "A WebGL & HTML5 graph based video composition library", | ||
@@ -5,0 +5,0 @@ "keywords":["video", "context", "composition", "timeline", "html5", "webgl"], |
@@ -10,2 +10,3 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
this._inputNames = inputNames; | ||
this._destroyed = false; | ||
@@ -57,3 +58,12 @@ //Setup WebGL output texture | ||
/** | ||
* Get whether the node has been destroyed or not. | ||
* | ||
* @return {boolean} A true/false value of whather the node has been destoryed or not. | ||
*/ | ||
get destroyed(){ | ||
return this._destroyed; | ||
} | ||
/** | ||
@@ -85,2 +95,13 @@ * Connect this node to the targetNode | ||
} | ||
/** | ||
* Destory this node, removing it from the graph. | ||
*/ | ||
destroy(){ | ||
this.disconnect(); | ||
for (let input of this.inputs){ | ||
input.disconnect(this); | ||
} | ||
this._destroyed = true; | ||
} | ||
} |
@@ -387,4 +387,22 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
} | ||
/** | ||
* Destroy and clean-up the node. | ||
*/ | ||
destroy(){ | ||
super.destroy(); | ||
this._triggerCallbacks("destroy"); | ||
this.unregisterCallback(); | ||
delete this._element; | ||
this._elementURL = undefined; | ||
this._state = STATE.waiting; | ||
this._currentTime = 0; | ||
this._startTime = NaN; | ||
this._stopTime = Infinity; | ||
this._ready = false; | ||
this._loadCalled = false; | ||
this._texture = undefined; | ||
} | ||
} | ||
export {STATE as SOURCENODESTATE}; |
@@ -178,2 +178,9 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
destroy(){ | ||
if (this._element) this._element.pause(); | ||
this._isElementPlaying = false; | ||
super.destroy(); | ||
this._destroy(); | ||
} | ||
} |
@@ -706,2 +706,13 @@ //Matthew Shotton, R&D User Experience,© BBC 2015 | ||
_update(dt){ | ||
//Remove any destroyed nodes | ||
this._sourceNodes = this._sourceNodes.filter(sourceNode=>{ | ||
if (!sourceNode.destroyed) return sourceNode; | ||
}); | ||
this._processingNodes = this._processingNodes.filter(processingNode=>{ | ||
if (!processingNode.destroyed) return processingNode; | ||
}); | ||
if (this._state === VideoContext.STATE.PLAYING || this._state === VideoContext.STATE.STALLED || this._state === VideoContext.STATE.PAUSED) { | ||
@@ -827,2 +838,31 @@ this._callCallbacks("update"); | ||
/** | ||
* Destroy all nodes in the graph and reset the timeline. After calling this any created nodes will be unusable. | ||
*/ | ||
reset(){ | ||
for (let callback of this._callbacks){ | ||
this.unregisterCallback(callback); | ||
} | ||
for (let node of this._sourceNodes){ | ||
node.destroy(); | ||
} | ||
for (let node of this._processingNodes){ | ||
node.destroy(); | ||
} | ||
this._update(0); | ||
this._sourceNodes = []; | ||
this._processingNodes = []; | ||
this._timeline = []; | ||
this._currentTime = 0; | ||
this._state = VideoContext.STATE.PAUSED; | ||
this._playbackRate = 1.0; | ||
this._sourcesPlaying = undefined; | ||
this._callbacks.set("stalled", []); | ||
this._callbacks.set("update", []); | ||
this._callbacks.set("ended", []); | ||
this._callbacks.set("content", []); | ||
this._callbacks.set("nocontent", []); | ||
this._timelineCallbacks = []; | ||
} | ||
_depricate(msg){ | ||
@@ -829,0 +869,0 @@ console.log(msg); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
6647939
25097