openrv-web / MediaAPI
Class: MediaAPI
Defined in: api/MediaAPI.ts:22
Constructors
Constructor
new MediaAPI(
session):MediaAPI
Defined in: api/MediaAPI.ts:25
Parameters
session
Session
Returns
MediaAPI
Methods
getCurrentSource()
getCurrentSource():
SourceInfo|null
Defined in: api/MediaAPI.ts:41
Get information about the currently loaded source.
Returns
SourceInfo | null
A SourceInfo object with name, type, dimensions, duration, and fps, or null if no media is loaded.
Example
const src = openrv.media.getCurrentSource();
if (src) console.log(`${src.name}: ${src.width}x${src.height}`);getDuration()
getDuration():
number
Defined in: api/MediaAPI.ts:65
Get total duration in frames.
Returns
number
The total number of frames in the current source, or 0 if no source is loaded.
Example
const frames = openrv.media.getDuration();getFPS()
getFPS():
number
Defined in: api/MediaAPI.ts:79
Get the frames per second of the current source.
Returns
number
The FPS value for the active session.
Example
const fps = openrv.media.getFPS(); // e.g. 24getResolution()
getResolution():
object
Defined in: api/MediaAPI.ts:94
Get the resolution of the current source.
Returns
object
An object with width and height in pixels, or { width: 0, height: 0 } if no source is loaded.
height
height:
number
width
width:
number
Example
const { width, height } = openrv.media.getResolution();getSourceCount()
getSourceCount():
number
Defined in: api/MediaAPI.ts:126
Get the number of loaded sources.
Returns
number
The count of media sources currently loaded in the session.
Example
const count = openrv.media.getSourceCount();hasMedia()
hasMedia():
boolean
Defined in: api/MediaAPI.ts:112
Check if any media source is currently loaded.
Returns
boolean
true if a source is loaded, false otherwise.
Example
if (openrv.media.hasMedia()) { openrv.playback.play(); }loadMovieProc()
loadMovieProc(
url):void
Defined in: api/MediaAPI.ts:169
Load a procedural source from a .movieproc URL string.
Parameters
url
string
The movieproc URL (e.g., 'smpte_bars,width=1920,height=1080.movieproc')
Returns
void
Example
openrv.media.loadMovieProc('checkerboard,cellSize=32.movieproc');loadProceduralSource()
loadProceduralSource(
pattern,options?):void
Defined in: api/MediaAPI.ts:143
Load a procedural test pattern as a source.
Parameters
pattern
PatternName
The pattern type to generate (e.g., 'smpte_bars', 'checkerboard')
options?
Optional configuration for resolution, color, and other parameters
cellSize?
number
color?
[number, number, number, number]
direction?
GradientDirection
duration?
number
fps?
number
height?
number
steps?
number
width?
number
Returns
void
Example
openrv.media.loadProceduralSource('smpte_bars');
openrv.media.loadProceduralSource('solid', { color: [1, 0, 0, 1] });
openrv.media.loadProceduralSource('checkerboard', { width: 3840, height: 2160, cellSize: 32 });