Constructor Summary
Public Constructor | ||
public |
Initialise an instance of a SourceNode. |
Member Summary
Public Members | ||
public get |
Returns the duration of the node on a timeline. |
|
public get |
element: Element: * Returns the underlying DOM element which represents this source node. |
|
public get |
startTime: * |
|
public get |
state: * Returns the state of the node. |
|
public get |
stopTime: * |
|
public set |
|
|
public get |
|
Private Members | ||
private |
_callbacks: *[] |
|
private |
_currentTime: * |
|
private |
|
|
private |
_element: * |
|
private |
_elementURL: * |
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
_startTime: * |
|
private |
_state: * |
|
private |
_stopTime: * |
|
private |
|
|
private |
_texture: * |
Method Summary
Public Methods | ||
public |
Clear any timeline state the node currently has, this puts the node in the "waiting" state, as if neither start nor stop had been called. |
|
public |
destroy() Destroy and clean-up the node. |
|
public |
registerCallback(type: String, func: function) Register callbacks against one of these events: "load", "destroy", "seek", "pause", "play", "ended", "durationchange", "loaded", "error" |
|
public |
Start playback at VideoContext.currentTime plus passed time. |
|
public |
Start playback at an absolute time ont the VideoContext's timeline. |
|
public |
Stop playback at VideoContext.currentTime plus passed time. |
|
public |
Stop playback at an absolute time ont the VideoContext's timeline. |
|
public |
unregisterCallback(func: function) Remove callback. |
Private Methods | ||
private |
|
|
private |
_load() |
|
private |
_pause() |
|
private |
_play() |
|
private |
_seek(time: *) |
|
private |
_triggerCallbacks(type: *, data: *) |
|
private |
_unload() |
|
private |
|
Inherited Summary
From class GraphNode | ||
public get |
Get whether the node has been destroyed or not. |
|
public get |
displayName: *: * Get a string representation of the class name. |
|
public get |
inputNames: String[]: * Get the names of the inputs to this node. |
|
public get |
Get an array of all the nodes which connect to this node. |
|
public get |
The maximum number of connections that can be made to this node. |
|
public get |
Get an array of all the nodes which this node outputs to. |
|
private |
|
|
private |
|
|
private |
_gl: * |
|
private |
_inputNames: * |
|
private |
|
|
private |
_renderGraph: * |
|
private |
|
|
public |
Connect this node to the targetNode |
|
public |
destroy() Destory this node, removing it from the graph. |
|
public |
disconnect(targetNode: GraphNode): * Disconnect this node from the targetNode. |
Public Constructors
public constructor() source
Initialise an instance of a SourceNode. This is the base class for other Nodes which generate media to be passed into the processing pipeline.
Override:
GraphNode#constructorPublic Members
public get duration: number: * source
Returns the duration of the node on a timeline. If no start time is set will return undefiend, if no stop time is set will return Infinity.
Example:
var ctx = new VideoContext();
var videoNode = ctx.createVideoSourceNode('video.mp4');
videoNode.start(5);
videoNode.stop(10);
console.log(videoNode.duration); //will output 10
public get element: Element: * source
Returns the underlying DOM element which represents this source node. Note: If a source node is created with a url rather than passing in an existing element then this will return undefined until the source node preloads the element.
Return:
Element | The underlying DOM element representing the media for the node. If the lifecycle of the video is owned UNSIGNED_BYTE the node itself, this can return undefined if the element hasn't been loaded yet. |
Example:
//Accessing the Element on a VideoNode created via a URL
var ctx = new VideoContext();
var videoNode = ctx.createVideoSourceNode('video.mp4');
videoNode.start(0);
videoNode.stop(5);
//When the node starts playing the element should exist so set it's volume to 0
videoNode.regsiterCallback("play", function(){videoNode.element.volume = 0;});
//Accessing the Element on a VideoNode created via an already existing element
var ctx = new VideoContext();
var videoElement = document.createElement("video");
var videoNode = ctx.createVideoSourceNode(videoElement);
videoNode.start(0);
videoNode.stop(5);
//The elemnt can be accessed any time because it's lifecycle is managed outside of the VideoContext
videoNode.element.volume = 0;
public get startTime: * source
public get state: * source
Returns the state of the node. 0 - Waiting, start() has not been called on it yet. 1 - Sequenced, start() has been called but it is not playing yet. 2 - Playing, the node is playing. 3 - Paused, the node is paused. 4 - Ended, playback of the node has finished.
Example:
var ctx = new VideoContext();
var videoNode = ctx.createVideoSourceNode('video.mp4');
console.log(videoNode.state); //will output 0 (for waiting)
videoNode.start(5);
console.log(videoNode.state); //will output 1 (for sequenced)
videoNode.stop(10);
ctx.play();
console.log(videoNode.state); //will output 2 (for playing)
ctx.paused();
console.log(videoNode.state); //will output 3 (for paused)
public get stopTime: * source
public set stretchPaused source
public get stretchPaused: * source
Private Members
private _callbacks: *[] source
private _currentTime: * source
private _element: * source
private _elementURL: * source
private _startTime: * source
private _state: * source
private _stopTime: * source
private _texture: * source
Public Methods
public clearTimelineState() source
Clear any timeline state the node currently has, this puts the node in the "waiting" state, as if neither start nor stop had been called.
public registerCallback(type: String, func: function) source
Register callbacks against one of these events: "load", "destroy", "seek", "pause", "play", "ended", "durationchange", "loaded", "error"
Example:
var ctx = new VideoContext();
var videoNode = ctx.createVideoSourceNode('video.mp4');
videoNode.registerCallback("load", function(){"video is loading"});
videoNode.registerCallback("play", function(){"video is playing"});
videoNode.registerCallback("ended", function(){"video has eneded"});
public start(time: number): boolean source
Start playback at VideoContext.currentTime plus passed time. If passed time is negative, will play as soon as possible.
Params:
Name | Type | Attribute | Description |
time | number | the time from the currentTime of the VideoContext which to start playing, if negative will play as soon as possible. |
public startAt(time: number): boolean source
Start playback at an absolute time ont the VideoContext's timeline.
Params:
Name | Type | Attribute | Description |
time | number | the time on the VideoContexts timeline to start playing. |
public stop(time: number): boolean source
Stop playback at VideoContext.currentTime plus passed time. If passed time is negative, will play as soon as possible.
Params:
Name | Type | Attribute | Description |
time | number | the time from the currentTime of the video context which to stop playback. |
Return:
boolean | Will return true is seqeuncing has succeded, or false if the playback has already ended or if start hasn't been called yet, or if time is less than the start time. |
public stopAt(time: number): boolean source
Stop playback at an absolute time ont the VideoContext's timeline.
Params:
Name | Type | Attribute | Description |
time | number | the time on the VideoContexts timeline to stop playing. |
Return:
boolean | Will return true is seqeuncing has succeded, or false if the playback has already ended or if start hasn't been called yet, or if time is less than the start time. |
public unregisterCallback(func: function) source
Remove callback.
Params:
Name | Type | Attribute | Description |
func | function |
|
the callback to remove, if undefined will remove all callbacks for this node. |
Example:
var ctx = new VideoContext();
var videoNode = ctx.createVideoSourceNode('video.mp4');
videoNode.registerCallback("load", function(){"video is loading"});
videoNode.registerCallback("play", function(){"video is playing"});
videoNode.registerCallback("ended", function(){"video has eneded"});
videoNode.unregisterCallback(); //remove all of the three callbacks.
Private Methods
private _load() source
private _pause() source
private _play() source
private _seek(time: *) source
Params:
Name | Type | Attribute | Description |
time | * |
private _triggerCallbacks(type: *, data: *) source
Params:
Name | Type | Attribute | Description |
type | * | ||
data | * |