Skip to content

openrv-web / MarkersAPI

Class: MarkersAPI

Defined in: api/MarkersAPI.ts:20

Constructors

Constructor

new MarkersAPI(session): MarkersAPI

Defined in: api/MarkersAPI.ts:23

Parameters

session

Session

Returns

MarkersAPI

Methods

add()

add(frame, note?, color?, endFrame?): void

Defined in: api/MarkersAPI.ts:42

Add a marker at the specified frame.

Parameters

frame

number

Frame number for the marker (1-based, must be positive).

note?

string

Optional note/comment text for the marker.

color?

string

Optional hex color string (e.g., '#ff0000'). Defaults to '#ff4444'.

endFrame?

number

Optional end frame for duration/range markers. Must be greater than frame.

Returns

void

Throws

If frame is not a positive number, or if note/color are provided but not strings, or if endFrame is invalid or not greater than frame.

Example

ts
openrv.markers.add(50, 'Review this', '#00ff00');

clear()

clear(): void

Defined in: api/MarkersAPI.ts:143

Clear all markers from the session.

Returns

void

Example

ts
openrv.markers.clear();

count()

count(): number

Defined in: api/MarkersAPI.ts:185

Get the total number of markers.

Returns

number

The count of markers in the session.

Example

ts
const n = openrv.markers.count();

get()

get(frame): MarkerInfo | null

Defined in: api/MarkersAPI.ts:121

Get marker at a specific frame.

Parameters

frame

number

The frame number to look up.

Returns

MarkerInfo | null

The MarkerInfo at that frame, or null if no marker exists there.

Example

ts
const marker = openrv.markers.get(50);
if (marker) console.log(marker.note);

getAll()

getAll(): MarkerInfo[]

Defined in: api/MarkersAPI.ts:92

Get all markers, sorted by frame number.

Returns

MarkerInfo[]

An array of MarkerInfo objects, sorted in ascending frame order.

Example

ts
const markers = openrv.markers.getAll();
markers.forEach(m => console.log(m.frame, m.note));

goToNext()

goToNext(): number | null

Defined in: api/MarkersAPI.ts:157

Navigate to the next marker from the current playback position.

Returns

number | null

The frame number of the next marker, or null if there is no subsequent marker.

Example

ts
const next = openrv.markers.goToNext();

goToPrevious()

goToPrevious(): number | null

Defined in: api/MarkersAPI.ts:171

Navigate to the previous marker from the current playback position.

Returns

number | null

The frame number of the previous marker, or null if there is no preceding marker.

Example

ts
const prev = openrv.markers.goToPrevious();

remove()

remove(frame): void

Defined in: api/MarkersAPI.ts:74

Remove a marker at the specified frame.

Parameters

frame

number

Frame number of the marker to remove (1-based).

Returns

void

Throws

If frame is not a valid number or is NaN.

Example

ts
openrv.markers.remove(50);

Released under the MIT License.