Player
is an instance object for replaying the video. It is constructed through the instance of WhiteWebSdk
(refer to 《Constructing Room and Player Objects》). It implements the Displayer
interface (refer to 《Displayer》), which is defined as follows.
interface Player extends Displayer {
readonly roomUUID: string;
readonly slice?: string;
readonly isPlayable: boolean;
readonly phase: PlayerPhase;
readonly state: PlayerState;
readonly progressTime: number;
readonly timeDuration: number;
readonly framesCount: number;
readonly beginTimestamp: number;
readonly mediaURL?: string;
playbackSpeed: number;
play(): void;
pause(): void;
stop(): void;
seekToProgressTime(progressTime: number): void;
setObserverMode(observerMode: ObserverMode): void;
}
The room uuid
to which the current video belongs. This is the unique identifier of the room.
The uuid
of the current video clip. It will change as the playback progress changes. You can get the change callback by listening to the onSliceChanged
event. Before the first frame is loaded, the value is undefined
.
Whether it can be played currently. That is, if calling player.play()
can play immediately, instead of caching.
The room status, its type PlayerPhase
is defined as follows.
enum PlayerPhase {
// Waiting for the first frame to load
WaitingFirstFrame = "waitingFirstFrame",
// Now Playing
Playing = "playing",
// time out
Pause = "pause",
// stopped playing
Stopped = "stop",
// Play to the end of the content
Ended = "ended",
// Cached
Buffering = "buffering",
}
You can get the status change callback by listening to the onPhaseChanged
event.
Business state, its type is PlayerState
. Read 《Business State Management of Room and Playback》, 《Room Business State Management》 to understand more.
The current playback progress, in milliseconds. Where 0
means the beginning of the content to be played. The maximum cannot exceed player.timeDuration
.
The total duration of the current recording, in milliseconds. The value of player.progressTime
will not exceed it.
The total number of frames of the current recording.
The start timestamp of the current recording is Unix time in milliseconds.
The URL of the media file to be played simultaneously with the whiteboard recording.
The playback speed, the default value is 1.0
. Indicates that the video content is played at several times the rate. Can be modified.
play(): void;
Start playing.
pause(): void;
time out.
stop(): void;
stop. player.phase
will become PlayerPhase.Stopped
, after that the player
instance will reject all business operations.
seekToProgressTime(progressTime: number): void;
Switch progress. This value will change the value of player.progressTime
. Since this method requires a network request to be initiated, the change will not take effect immediately. During the waiting process player.phase
will be in the PlayerPhase.Buffering
state.
setObserverMode(observerMode: ObserverMode): void;
Switch to observer mode. Refer to 《observermode|Business state management of room and playback》.