Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cast events #58

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Changelog
All changes to this project will be documented in this file.

## [1.2.27] - 2023-12-08
- Add chromecast & airplay events

## [1.2.26] - 2023-10-05
- Add isLiveStream()

## [1.2.25] - 2023-06-02
- Add ads support

## [1.2.24] - 2023-03-03
- Add `sequence` option

Expand Down
84 changes: 26 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,6 @@
- [Instantiation](#instantiation)
- [Ads](#ads)
- [Methods](#methods)
- [`loadConfig(options: SdkOptions)`](#loadconfigoptions-sdkoptions)
- [`play()`](#play)
- [`pause()`](#pause)
- [`mute()`](#mute)
- [`unmute()`](#unmute)
- [`hideControls(controls?: ControlName[])`](#hidecontrolscontrols-controlname)
- [`showControls(controls?: ControlName[])`](#showcontrolscontrols-controlname)
- [`setChromeless(chromeless: boolean)`](#setchromelesschromeless-boolean)
- [`hideSubtitles()`](#hidesubtitles)
- [`showSubtitles()`](#showsubtitles)
- [`hideTitles()`](#hidetitles)
- [`showTitles()`](#showtitles)
- [`setLoop(loop: boolean)`](#setlooploop-boolean)
- [`setAutoplay(autoplay: boolean)`](#setautoplayautoplay-boolean)
- [`seek(time: number)`](#seektime-number)
- [`setPlaybackRate(rate: number)`](#setplaybackraterate-number)
- [`setCurrentTime(time: number)`](#setcurrenttimetime-number)
- [`setVolume(volume: number)`](#setvolumevolume-number)
- [`setVideoStyleObjectFit(value: "contain" | "cover" | "fill" | "none" | "scale-down")`](#setvideostyleobjectfitvalue-contain--cover--fill--none--scale-down)
- [`setVideoStyleTransform(value: string)`](#setvideostyletransformvalue-string)
- [`setTheme(theme: PlayerTheme)`](#setthemetheme-playertheme)
- [`requestFullscreen()`](#requestfullscreen)
- [`exitFullscreen()`](#exitfullscreen)
- [`requestPictureInPicture()`](#requestpictureinpicture)
- [`exitPictureInPicture()`](#exitpictureinpicture)
- [`getPaused(callback?: (paused: boolean) => void): Promise<boolean>`](#getpausedcallback-paused-boolean--void-promiseboolean)
- [`getPlaying(callback?: (playing: boolean) => void): Promise<boolean>`](#getplayingcallback-playing-boolean--void-promiseboolean)
- [`getMuted(callback?: (muted: boolean) => void): Promise<boolean>`](#getmutedcallback-muted-boolean--void-promiseboolean)
- [`getDuration(callback?: (duration: number) => void): Promise<number>`](#getdurationcallback-duration-number--void-promisenumber)
- [`getCurrentTime(callback?: (currentTime: number) => void): Promise<number>`](#getcurrenttimecallback-currenttime-number--void-promisenumber)
- [`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)
- [Control an existing embedded player using the SDK](#control-an-existing-embedded-player-using-the-sdk)

Expand Down Expand Up @@ -430,28 +394,32 @@ Define a callback function that will be called when the given event is triggered

Available events are the following:

Event name | Description | Parameter
---: | --- | ---
controlsdisabled | Controls are now disabled | -
controlsenabled | Controls are now enabled | -
ended | The playback as reached the ended of the video | -
error | An error occured | -
firstplay | The video started to play for the first time | -
fullscreenchange | The player goes to (or goes back from) full screen | -
mouseenter | The user's mouse entered the player area | -
mouseleave | The user's mouse leaved the player area | -
pause | The video has been paused | -
play | The video started to play (for the first time or after having been paused) | -
playerresize | The player size has changed | -
qualitychange | The video quality has changed | `{ resolution: { height: number, width: number } }`
ratechange | The playback rate has changed | -
ready | The player is ready to play | -
resize | The video size has changed
seeking | The player is seeking | -
timeupdate | The playback time has changed | `{ currentTime: number }`
useractive | The user is active | -
userinactive | The user is inactive | -
volumechange | The volume has changed | `{ volume: number }`
Event name | Description | Parameter
---: | --- | ---
airplayConnected | Started to play on an airplay device | -
airplayDisconnected | Stopped to play on an airplay device | -
chromecastConnected | Started to play on a chromecast device | -
chromecastDisconnected | Stopped to play on a chromecast device | -
controlsdisabled | Controls are now disabled | -
controlsenabled | Controls are now enabled | -
ended | The playback as reached the ended of the video | -
error | An error occured | -
firstplay | The video started to play for the first time | -
fullscreenchange | The player goes to (or goes back from) full screen | -
mouseenter | The user's mouse entered the player area | -
mouseleave | The user's mouse leaved the player area | -
pause | The video has been paused | -
play | The video started to play (for the first time or after having been paused) | -
playerresize | The player size has changed | -
qualitychange | The video quality has changed | `{ resolution: { height: number, width: number } }`
ratechange | The playback rate has changed | -
ready | The player is ready to play | -
resize | The video size has changed
seeking | The player is seeking | -
timeupdate | The playback time has changed | `{ currentTime: number }`
useractive | The user is active | -
userinactive | The user is inactive | -
volumechange | The volume has changed | `{ volume: number }`

Examples:
```javascript
Expand Down
4 changes: 4 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ type SdkOptions = {
}

type PlayerSdkEvent = {
airplayConnected: () => void;
airplayDisconnected: () => void;
chromecastConnected: () => void;
chromecastDisconnected: () => void;
controlsdisabled: () => void;
controlsenabled: () => void;
ended: () => void;
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.26",
"version": "1.2.27",
"description": "api.video player SDK",
"repository": {
"type": "git",
Expand Down
Loading