Created
July 15, 2022 15:18
-
-
Save bkwhite/1364b370bc220c5e66b2efd01d777712 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Methods required by a custom player for `react-player` | |
*/ | |
export interface Player { | |
load(url?: string): void; | |
seekTo(amount: number, type?: 'seconds' | 'fraction'): void; | |
getCurrentTime(): number; | |
getDuration(): number; | |
getSecondsLoaded(): number | null; | |
stop?(): void; | |
} | |
export interface IkWidget { | |
embed: (targetId: string, settings: KalturaSettings) => boolean | null; | |
} | |
export type KalturaSettings = { | |
targetId?: string; | |
wid: string; | |
uiconf_id?: string; | |
entry_id: string; | |
flashvars: object; | |
params: object; | |
cache_st?: string; | |
readyCallback?: () => void; | |
}; | |
export interface KalturaPlayerElement extends HTMLElement { | |
kBind: ( | |
eventName: KalturaPlayerEvents, | |
callback: (data: string | number | KalturaMediaPlayState, id?: string) => void | |
) => void; | |
evaluate: (property: string) => string | number; | |
sendNotification: (notificationName: KalturaNotificationName, notificationData?: any) => void; | |
} | |
export type KalturaMediaPlayState = | |
| 'uninitialized' | |
| 'loading' | |
| 'ready' | |
| 'playing' | |
| 'paused' | |
| 'buffering' | |
| 'playbackError'; | |
export enum KalturaPlayerEvents { | |
MEDIA_READY = 'mediaReady', | |
FIRST_PLAY = 'firstPlay', | |
PLAYER_PLAY_END = 'playerPlayEnd', | |
PLAYER_PLAYED = 'playerPlayed', | |
PLAYER_PAUSED = 'playerPaused', | |
BUFFER_START_EVENT = 'bufferStartEvent', | |
MEDIA_ERROR = 'mediaError' | |
} | |
// List - http://player.kaltura.com/docs/api#doPause | |
export enum KalturaNotificationName { | |
DO_PAUSE = 'doPause', | |
DO_PLAY = 'doPlay', | |
DO_STOP = 'doStop', | |
DO_SEEK = 'doSeek', | |
CHANGE_VOLUME = 'changeVolume', | |
DO_SWITCH = 'doSwitch', | |
CHANGE_PREFERRED_BITRATE = 'changePreferredBitrate', | |
DO_REPLAY = 'doReplay', | |
ALERT = 'alert', | |
SHOW_UI_ELEMENT = 'showUiElement', | |
REMOVE_ALERTS = 'removeAlerts', | |
ENABLE_GUI = 'enableGui', | |
CANCEL_ALERTS = 'cancelAlerts', | |
LIVE_ENTRY = 'liveEntry', | |
SHOW_CLOSED_CAPTIONS = 'showClosedCaptions', | |
HIDE_CLOSED_CAPTIONS = 'hideClosedCaptions' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kaltura Player for
react-player
: https://gist.github.com/bkwhite/90a18f8269c94f0d27d7b9dc12db4f6a