Skip to main content

Player

Static properties#

Context#

React Context containing a reference to the ambient player. If you are using Hooks, you can use usePlayer() instead.

static Context: React.Context<Player>;

Static methods#

allowScroll()#

Prevents intercepting of scroll on mobile. See Scroll events in the Authoring guide.

static allowScroll(e: React.TouchEvent | TouchEvent): void;

preventCanvasClick()#

Prevents a click from pausing/playing the video. See Canvas clicks in the Authoring guide.

static preventCanvasClick(e: React.MouseEvent | MouseEvent): void;

Properties#

canPlay#

canPlay: Promise<void[]>;

canPlayThrough#

canPlayThrough: Promise<void[]>;

canvas#

The div where ractive content is attached (which is separate from ractive controls).

canvas: HTMLDivElement;

hub#

An EventEmitter that your code can subscribe to. Emits the following events:

NameDescription
canplayFired when the ractive is ready to start playing, but may not be able to play to its end without having to stop for further buffering of content.
canplaythroughFired when the ractive is ready to start playing, and will be able to play up to its end without having to stop for further buffering of content.
canvasClickFired when a click happens anywhere on the canvas, which by default pauses/resumes the video. See Canvas clicks in the Authoring guide.
hub: StrictEventEmitter<EventEmitter, {
"canplay": void;
"canplaythrough": void;
"canvasClick": void;
}>;

keymap#

The KeyMap instance attached to this player.

keymap: KeyMap;

playback#

The underlying Playback instance.

playback: Playback;

script#

The underlying Script instance.

script: Script;

Methods#

obstruct()#

obstruct(event: "canplay" | "canplaythrough", task: Promise<unknown>): void;

ready()#

Call this method when the ractive is ready to begin playing.

ready(): void;

resumeKeyCapture()#

Resumes keyboard controls. See Forms in the Authoring guide.

resumeKeyCapture(): void;

suspendKeyCapture()#

Suspends keyboard controls so that components can receive keyboard input. See Forms in the Authoring guide.

suspendKeyCapture(): void;