Skip to content

Commit

Permalink
Add isLiveStream() method
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierapivideo committed Oct 5, 2023
1 parent 0ea53d7 commit 3a18dae
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog
All changes to this project will be documented in this file.

## [1.2.26] - 2023-10-05
- Add isLiveStream()
## [1.2.25] - 2023-06-02
- Add ads support
## [1.2.24] - 2023-03-03
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- [`getVolume(callback?: (volume: number) => void): Promise<number>`](#getvolumecallback-volume-number--void-promisenumber)
- [`getLoop(callback?: (loop: boolean) => void): Promise<boolean>`](#getloopcallback-loop-boolean--void-promiseboolean)
- [`getPlaybackRate(callback?: (rate: number) => void): Promise<number>`](#getplaybackratecallback-rate-number--void-promisenumber)
- [`isLiveStream(callback?: (live: boolean) => void): Promise<boolean>`](#islivestreamcallback-live-boolean--void-promiseboolean)
- [`destroy()`](#destroy)
- [`addEventListener(event: string, callback: () => void)`](#addeventlistenerevent-string-callback---void)
- [Full example](#full-example)
Expand Down Expand Up @@ -344,6 +345,8 @@ The sdk instance has the following methods:
> Check whether the video is in loop mode.
#### `getPlaybackRate(callback?: (rate: number) => void): Promise<number>`
> Retrieve the playback rate.
#### `isLiveStream(callback?: (live: boolean) => void): Promise<boolean>`
> Check whether the video is a live stream.
#### `destroy()`
> Destroy the player instance.
#### `addEventListener(event: string, callback: () => void)`
Expand Down
3 changes: 3 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,9 @@ export class PlayerSdk {
getVideoSize(callback?: (size: {width: number, height: number}) => void): Promise<{width: number, height: number}> {
return this.postMessage({ message: 'getVideoSize' }, callback, true);
}
isLiveStream(callback?: (isLiveStream: boolean) => void): Promise<boolean> {
return this.postMessage({ message: 'isLiveStream' }, callback);
}

addEventListener<K extends keyof PlayerSdkEvent>(event: K, callback: PlayerSdkEvent[K]) {
this.userEventListeners.push({ event, callback });
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@api.video/player-sdk",
"version": "1.2.25",
"version": "1.2.26",
"description": "api.video player SDK",
"repository": {
"type": "git",
Expand Down

0 comments on commit 3a18dae

Please sign in to comment.