Ivs player for Capacitor app Android and IOS.
npm install @capgo/ivs-player
npx cap sync
create(...)
start()
cast()
getCastStatus()
pause()
delete()
getUrl()
getState()
setPlayerPosition(...)
getPlayerPosition()
setAutoQuality(...)
getAutoQuality()
setPip(...)
getPip()
setFrame(...)
getFrame()
setBackgroundState(...)
getBackgroundState()
setMute(...)
getMute()
setQuality(...)
getQuality()
getQualities()
getPluginVersion()
addListener('startPip', ...)
addListener('stopPip', ...)
addListener('expandPip', ...)
addListener('closePip', ...)
addListener('onState', ...)
addListener('onCues', ...)
addListener('onDuration', ...)
addListener('onError', ...)
addListener('onRebuffering', ...)
addListener('onSeekCompleted', ...)
addListener('onVideoSize', ...)
addListener('onQuality', ...)
addListener('onCastStatus', ...)
removeAllListeners()
create(options: { url: string; pip?: boolean; title?: string; subtitle?: string; cover?: string; autoPlay?: boolean; toBack?: boolean; x?: number; y?: number; width?: number; height?: number; }) => Promise<void>
Param | Type |
---|---|
options |
{ url: string; pip?: boolean; title?: string; subtitle?: string; cover?: string; autoPlay?: boolean; toBack?: boolean; x?: number; y?: number; width?: number; height?: number; } |
start() => Promise<void>
cast() => Promise<void>
getCastStatus() => Promise<{ isActive: boolean; }>
Returns: Promise<{ isActive: boolean; }>
pause() => Promise<void>
delete() => Promise<void>
getUrl() => Promise<{ url: string; }>
Returns: Promise<{ url: string; }>
getState() => Promise<{ state: CapacitorIvsPlayerState; }>
Returns: Promise<{ state: CapacitorIvsPlayerState; }>
setPlayerPosition(options?: { toBack: boolean; } | undefined) => Promise<void>
Param | Type |
---|---|
options |
{ toBack: boolean; } |
getPlayerPosition() => Promise<{ toBack: boolean; }>
Returns: Promise<{ toBack: boolean; }>
setAutoQuality(options?: { autoQuality?: boolean | undefined; } | undefined) => Promise<void>
Param | Type |
---|---|
options |
{ autoQuality?: boolean; } |
getAutoQuality() => Promise<{ autoQuality: boolean; }>
Returns: Promise<{ autoQuality: boolean; }>
setPip(options?: { pip?: boolean | undefined; } | undefined) => Promise<void>
Param | Type |
---|---|
options |
{ pip?: boolean; } |
getPip() => Promise<{ pip: boolean; }>
Returns: Promise<{ pip: boolean; }>
setFrame(options?: { x?: number | undefined; y?: number | undefined; width?: number | undefined; height?: number | undefined; } | undefined) => Promise<void>
Set the frame of the player view, all number have to be positive and integers
Param | Type | Description |
---|---|---|
options |
{ x?: number; y?: number; width?: number; height?: number; } |
: number, y: number, width: number, height: number} |
Since: 1.0.0
getFrame() => Promise<CapacitorFrame>
Returns: Promise<CapacitorFrame>
setBackgroundState(options: { backgroundState: CapacitorIvsPlayerBackgroundState; }) => Promise<void>
Param | Type |
---|---|
options |
{ backgroundState: CapacitorIvsPlayerBackgroundState; } |
getBackgroundState() => Promise<{ backgroundState: CapacitorIvsPlayerBackgroundState; }>
Returns: Promise<{ backgroundState: CapacitorIvsPlayerBackgroundState; }>
setMute(options?: { muted?: boolean | undefined; } | undefined) => Promise<void>
Param | Type |
---|---|
options |
{ muted?: boolean; } |
getMute() => Promise<{ mute: boolean; }>
Returns: Promise<{ mute: boolean; }>
setQuality(options?: { quality: string; } | undefined) => Promise<void>
Param | Type |
---|---|
options |
{ quality: string; } |
getQuality() => Promise<{ quality: string; }>
Returns: Promise<{ quality: string; }>
getQualities() => Promise<{ qualities: string[]; }>
Returns: Promise<{ qualities: string[]; }>
getPluginVersion() => Promise<{ version: string; }>
Get the native Capacitor plugin version
Returns: Promise<{ version: string; }>
addListener(eventName: "startPip", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for start pip
Param | Type |
---|---|
eventName |
'startPip' |
listenerFunc |
() => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "stopPip", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for stop pip
Param | Type |
---|---|
eventName |
'stopPip' |
listenerFunc |
() => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "expandPip", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for expend pip
Param | Type |
---|---|
eventName |
'expandPip' |
listenerFunc |
() => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "closePip", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for close pip
Param | Type |
---|---|
eventName |
'closePip' |
listenerFunc |
() => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onState", listenerFunc: (data: { state: CapacitorIvsPlayerState; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for state changes
Param | Type |
---|---|
eventName |
'onState' |
listenerFunc |
(data: { state: CapacitorIvsPlayerState; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onCues", listenerFunc: (data: { cues: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for cue changes
Param | Type |
---|---|
eventName |
'onCues' |
listenerFunc |
(data: { cues: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onDuration", listenerFunc: (data: { duration: number; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for duration changes
Param | Type |
---|---|
eventName |
'onDuration' |
listenerFunc |
(data: { duration: number; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onError", listenerFunc: (data: { error: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for errors
Param | Type |
---|---|
eventName |
'onError' |
listenerFunc |
(data: { error: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onRebuffering", listenerFunc: () => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for rebuffering
Param | Type |
---|---|
eventName |
'onRebuffering' |
listenerFunc |
() => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onSeekCompleted", listenerFunc: (data: { position: number; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for position changes
Param | Type |
---|---|
eventName |
'onSeekCompleted' |
listenerFunc |
(data: { position: number; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onVideoSize", listenerFunc: (data: { width: number; height: number; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for video size changes
Param | Type |
---|---|
eventName |
'onVideoSize' |
listenerFunc |
(data: { width: number; height: number; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onQuality", listenerFunc: (data: { quality: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for quality changes
Param | Type |
---|---|
eventName |
'onQuality' |
listenerFunc |
(data: { quality: string; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
addListener(eventName: "onCastStatus", listenerFunc: (data: { isActive: boolean; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
Listen for cast status changes
Param | Type |
---|---|
eventName |
'onCastStatus' |
listenerFunc |
(data: { isActive: boolean; }) => void |
Returns: Promise<PluginListenerHandle> & PluginListenerHandle
Since: 1.0.0
removeAllListeners() => Promise<void>
Remove all listeners for this plugin.
Since: 1.0.0
Prop | Type |
---|---|
x |
number |
y |
number |
width |
number |
height |
number |
Prop | Type |
---|---|
remove |
() => Promise<void> |
"IDLE" | "BUFFERING" | "READY" | "PLAYING" | "ENDED" | "UNKNOWN"
"PAUSED" | "PLAYING"
To install the @capgo/ivs-player package, you need to run the following command:
npm install @capgo/ivs-player
npx cap sync
The @capgo/ivs-player package provides the following API:
This method creates an instance of the IVS player. It takes an options object as a parameter, which contains various properties such as the URL of the video, whether to enable picture-in-picture mode, the title and subtitle of the video, and more. It returns a Promise that resolves to the created instance.
This method starts playing the video in the IVS player. It returns a Promise.
This method casts the video to a connected device. It returns a Promise.
This method retrieves the status of the casting feature. It returns a Promise that resolves to an object containing the isActive property, which indicates whether casting is active.
This method pauses the video playback. It returns a Promise.
This method deletes the IVS player instance. It returns a Promise.
This method retrieves the URL of the video that is currently being played. It returns a Promise.
This method retrieves the current state of the IVS player. It returns a Promise.
This method sets the position of the IVS player on the screen. It takes x and y coordinates as parameters and returns a Promise.
This method retrieves the current position of the IVS player on the screen. It returns a Promise.
This method sets the auto quality mode of the IVS player. It takes a boolean value as a parameter and returns a Promise.
This method retrieves the current auto quality mode of the IVS player. It returns a Promise.
This method sets the picture-in-picture mode of the IVS player. It takes a boolean value as a parameter and returns a Promise.
This method retrieves the current picture-in-picture mode of the IVS player. It returns a Promise.
This method sets the frame of the IVS player. It takes a number value as a parameter and returns a Promise.
This method retrieves the current frame of the IVS player. It returns a Promise.
This method sets the mute mode of the IVS player. It takes a boolean value as a parameter and returns a Promise.
This method retrieves the current mute mode of the IVS player. It returns a Promise.
This method sets the quality of the video in the IVS player. It takes a string value as a parameter and returns a Promise.
This method retrieves the current quality of the video in the IVS player. It returns a Promise.
This method retrieves the available qualities of the video in the IVS player. It returns a Promise.
This method adds a listener for the expandPip event. It takes a callback function as a parameter and returns void.
This method adds a listener for the closePip event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onState event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onCues event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onDuration event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onError event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onRebuffering event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onSeekCompleted event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onVideoSize event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onQuality event. It takes a callback function as a parameter and returns void.
This method adds a listener for the onCastStatus event. It takes a callback function as a parameter and returns void.
This method removes all the added event listeners. It returns void.
The @capgo/ivs-player package provides a comprehensive API for integrating an IVS player into your Capacitor app. By following the installation steps and referencing the API documentation, you can easily start playing videos in your app using the IVS player.