Skip to content

Commit

Permalink
fix: getVideoState() snipet (#454)
Browse files Browse the repository at this point in the history
* fix: getVideoState snipet

Signed-off-by: Pravus <[email protected]>

* final fix

Signed-off-by: Pravus <[email protected]>

---------

Signed-off-by: Pravus <[email protected]>
  • Loading branch information
pravusjif authored Nov 7, 2024
1 parent 340fb3a commit 554066d
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions content/creator/sdk7/media/video-playing.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,21 +346,16 @@ The videoEvent object passed as an input for the function contains the following

### Latest video event

Query a video for its last state change by using `getVideoState`. This function returns an object with a `currentState` property, with one of the following values from the `VideoState` enum, indicating the current state of the video:

- `VideoState.VS_READY`
- `VideoState.VS_NONE`
- `VideoState.VS_ERROR`
- `VideoState.VS_SEEKING`
- `VideoState.VS_LOADING`
- `VideoState.VS_BUFFERING`
- `VideoState.VS_PLAYING`
- `VideoState.VS_PAUSED`
Query a video for its last state change by using `videoEventsSystem.getVideoState()`. This function always returns the latest `VideoEvent` value for the video.

```ts
function mySystem() {
const latestVideoEvent = getVideoState(videoPlayerEntity)
console.log(latestVideoEvent.currentState)
const latestVideoEvent = videoEventsSystem.getVideoState(videoPlayerEntity)
if(!latestVideoEvent) return

console.log(`state: ${latestVideoEvent.state}
\ncurrentOffset: ${latestVideoEvent.currentOffset}
\nvideoLength: ${latestVideoEvent.videoLength}`)
}
```

Expand Down

0 comments on commit 554066d

Please sign in to comment.