Skip to content

textmode.js / media / TextmodeVideo

Class: TextmodeVideo

Video source for textmode rendering.

Create one with Textmodifier.loadVideo, draw it with Textmodifier.image, control playback with video methods, and configure conversion through inherited chainable methods.

Example

Extends

Character & color mapping

MethodDescription
backgroundSet the background color used for transparent pixels.
cellColorSet the cell color used when cellColorMode is 'fixed'.
cellColorModeSet whether cell color is sampled from the source or fixed.
charactersSet the characters used for brightness mapping.
charColorSet the character color used when charColorMode is 'fixed'.
charColorModeSet whether character color is sampled from the source or fixed.

Conversion

MethodDescription
brightnessRangeCapture only source pixels whose brightness is inside the inclusive byte range.
clearConversionsClear this source's conversion stack and return to single-mode conversion.
conversionModeSelect the conversion mode for this source.
conversionsSet an ordered conversion stack for this source.

Other

AccessorDescription
sourceSource element this texture captures.

Playback

Start, pause, stop, seek, loop, and adjust the speed or volume.

MethodDescription
loopSet whether the video loops.
pausePause video playback.
playStart video playback.
speedSet playback speed.
stopStop the video and seek to the beginning.
timeSeek to a playback time.
volumeSet playback volume.

Playback state

Read the underlying video element and its current timing state.

AccessorDescription
currentTimeCurrent playback time in seconds.
durationTotal video duration in seconds.
isPlayingWhether the video is currently playing.
videoElementUnderlying HTML video element.

Resource lifecycle

MethodDescription
disposeDispose the video source and release the backing media element.

Source dimensions

AccessorDescription
heightIdeal draw height in grid cells.
originalHeightOriginal source height in pixels.
originalWidthOriginal source width in pixels.
textureWebGL texture backing this source.
widthIdeal draw width in grid cells.

Source transforms

MethodDescription
charRotationRotate generated characters.
flipXFlip the source horizontally.
flipYFlip the source vertically.
invertEnable or disable source color inversion.