From fa70b49ccbe57fd4b01aad6b45d28aa9c2c0c512 Mon Sep 17 00:00:00 2001 From: Olivier Lando Date: Fri, 8 Dec 2023 16:28:06 +0100 Subject: [PATCH] Add cast events --- CHANGELOG.md | 5 +++ README.md | 84 +++++++++++++++-------------------------------- index.ts | 4 +++ package-lock.json | 4 +-- package.json | 2 +- 5 files changed, 38 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 268ba37..3808017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index b555fcc..07a7007 100644 --- a/README.md +++ b/README.md @@ -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`](#getpausedcallback-paused-boolean--void-promiseboolean) - - [`getPlaying(callback?: (playing: boolean) => void): Promise`](#getplayingcallback-playing-boolean--void-promiseboolean) - - [`getMuted(callback?: (muted: boolean) => void): Promise`](#getmutedcallback-muted-boolean--void-promiseboolean) - - [`getDuration(callback?: (duration: number) => void): Promise`](#getdurationcallback-duration-number--void-promisenumber) - - [`getCurrentTime(callback?: (currentTime: number) => void): Promise`](#getcurrenttimecallback-currenttime-number--void-promisenumber) - - [`getVolume(callback?: (volume: number) => void): Promise`](#getvolumecallback-volume-number--void-promisenumber) - - [`getLoop(callback?: (loop: boolean) => void): Promise`](#getloopcallback-loop-boolean--void-promiseboolean) - - [`getPlaybackRate(callback?: (rate: number) => void): Promise`](#getplaybackratecallback-rate-number--void-promisenumber) - - [`isLiveStream(callback?: (live: boolean) => void): Promise`](#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) @@ -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 diff --git a/index.ts b/index.ts index 8eb8d2c..a830a23 100644 --- a/index.ts +++ b/index.ts @@ -51,6 +51,10 @@ type SdkOptions = { } type PlayerSdkEvent = { + airplayConnected: () => void; + airplayDisconnected: () => void; + chromecastConnected: () => void; + chromecastDisconnected: () => void; controlsdisabled: () => void; controlsenabled: () => void; ended: () => void; diff --git a/package-lock.json b/package-lock.json index a272655..74f2d0b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@api.video/player-sdk", - "version": "1.2.26", + "version": "1.2.27", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@api.video/player-sdk", - "version": "1.2.26", + "version": "1.2.27", "license": "MIT", "dependencies": { "core-js": "^3.8.3", diff --git a/package.json b/package.json index 0063ef7..9937922 100644 --- a/package.json +++ b/package.json @@ -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",