Awesome
@capgo/ivs-player
<a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
<div align="center"> <h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo 🚀</a></h2> <h2><a href="https://capgo.app/consulting/?ref=plugin"> Fix your annoying bug now, Hire a Capacitor expert 💪</a></h2> </div>Ivs player for Capacitor app Android and IOS.
Install
npm install @capgo/ivs-player
npx cap sync
API
<docgen-index>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()
- Interfaces
- Type Aliases
create(...)
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 | <code>{ url: string; pip?: boolean; title?: string; subtitle?: string; cover?: string; autoPlay?: boolean; toBack?: boolean; x?: number; y?: number; width?: number; height?: number; }</code> |
start()
start() => Promise<void>
cast()
cast() => Promise<void>
getCastStatus()
getCastStatus() => Promise<{ isActive: boolean; }>
Returns: <code>Promise<{ isActive: boolean; }></code>
pause()
pause() => Promise<void>
delete()
delete() => Promise<void>
getUrl()
getUrl() => Promise<{ url: string; }>
Returns: <code>Promise<{ url: string; }></code>
getState()
getState() => Promise<{ state: CapacitorIvsPlayerState; }>
Returns: <code>Promise<{ state: <a href="#capacitorivsplayerstate">CapacitorIvsPlayerState</a>; }></code>
setPlayerPosition(...)
setPlayerPosition(options?: { toBack: boolean; } | undefined) => Promise<void>
Param | Type |
---|---|
options | <code>{ toBack: boolean; }</code> |
getPlayerPosition()
getPlayerPosition() => Promise<{ toBack: boolean; }>
Returns: <code>Promise<{ toBack: boolean; }></code>
setAutoQuality(...)
setAutoQuality(options?: { autoQuality?: boolean | undefined; } | undefined) => Promise<void>
Param | Type |
---|---|
options | <code>{ autoQuality?: boolean; }</code> |
getAutoQuality()
getAutoQuality() => Promise<{ autoQuality: boolean; }>
Returns: <code>Promise<{ autoQuality: boolean; }></code>
setPip(...)
setPip(options?: { pip?: boolean | undefined; } | undefined) => Promise<void>
Param | Type |
---|---|
options | <code>{ pip?: boolean; }</code> |
getPip()
getPip() => Promise<{ pip: boolean; }>
Returns: <code>Promise<{ pip: boolean; }></code>
setFrame(...)
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 | <code>{ x?: number; y?: number; width?: number; height?: number; }</code> | : number, y: number, width: number, height: number} |
Since: 1.0.0
getFrame()
getFrame() => Promise<CapacitorFrame>
Returns: <code>Promise<<a href="#capacitorframe">CapacitorFrame</a>></code>
setBackgroundState(...)
setBackgroundState(options: { backgroundState: CapacitorIvsPlayerBackgroundState; }) => Promise<void>
Param | Type |
---|---|
options | <code>{ backgroundState: <a href="#capacitorivsplayerbackgroundstate">CapacitorIvsPlayerBackgroundState</a>; }</code> |
getBackgroundState()
getBackgroundState() => Promise<{ backgroundState: CapacitorIvsPlayerBackgroundState; }>
Returns: <code>Promise<{ backgroundState: <a href="#capacitorivsplayerbackgroundstate">CapacitorIvsPlayerBackgroundState</a>; }></code>
setMute(...)
setMute(options?: { muted?: boolean | undefined; } | undefined) => Promise<void>
Param | Type |
---|---|
options | <code>{ muted?: boolean; }</code> |
getMute()
getMute() => Promise<{ mute: boolean; }>
Returns: <code>Promise<{ mute: boolean; }></code>
setQuality(...)
setQuality(options?: { quality: string; } | undefined) => Promise<void>
Param | Type |
---|---|
options | <code>{ quality: string; }</code> |
getQuality()
getQuality() => Promise<{ quality: string; }>
Returns: <code>Promise<{ quality: string; }></code>
getQualities()
getQualities() => Promise<{ qualities: string[]; }>
Returns: <code>Promise<{ qualities: string[]; }></code>
getPluginVersion()
getPluginVersion() => Promise<{ version: string; }>
Get the native Capacitor plugin version
Returns: <code>Promise<{ version: string; }></code>
addListener('startPip', ...)
addListener(eventName: "startPip", listenerFunc: () => void) => Promise<PluginListenerHandle>
Listen for start pip
Param | Type |
---|---|
eventName | <code>'startPip'</code> |
listenerFunc | <code>() => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('stopPip', ...)
addListener(eventName: "stopPip", listenerFunc: () => void) => Promise<PluginListenerHandle>
Listen for stop pip
Param | Type |
---|---|
eventName | <code>'stopPip'</code> |
listenerFunc | <code>() => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('expandPip', ...)
addListener(eventName: "expandPip", listenerFunc: () => void) => Promise<PluginListenerHandle>
Listen for expend pip
Param | Type |
---|---|
eventName | <code>'expandPip'</code> |
listenerFunc | <code>() => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('closePip', ...)
addListener(eventName: "closePip", listenerFunc: () => void) => Promise<PluginListenerHandle>
Listen for close pip
Param | Type |
---|---|
eventName | <code>'closePip'</code> |
listenerFunc | <code>() => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onState', ...)
addListener(eventName: "onState", listenerFunc: (data: { state: CapacitorIvsPlayerState; }) => void) => Promise<PluginListenerHandle>
Listen for state changes
Param | Type |
---|---|
eventName | <code>'onState'</code> |
listenerFunc | <code>(data: { state: <a href="#capacitorivsplayerstate">CapacitorIvsPlayerState</a>; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onCues', ...)
addListener(eventName: "onCues", listenerFunc: (data: { cues: string; }) => void) => Promise<PluginListenerHandle>
Listen for cue changes
Param | Type |
---|---|
eventName | <code>'onCues'</code> |
listenerFunc | <code>(data: { cues: string; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onDuration', ...)
addListener(eventName: "onDuration", listenerFunc: (data: { duration: number; }) => void) => Promise<PluginListenerHandle>
Listen for duration changes
Param | Type |
---|---|
eventName | <code>'onDuration'</code> |
listenerFunc | <code>(data: { duration: number; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onError', ...)
addListener(eventName: "onError", listenerFunc: (data: { error: string; }) => void) => Promise<PluginListenerHandle>
Listen for errors
Param | Type |
---|---|
eventName | <code>'onError'</code> |
listenerFunc | <code>(data: { error: string; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onRebuffering', ...)
addListener(eventName: "onRebuffering", listenerFunc: () => void) => Promise<PluginListenerHandle>
Listen for rebuffering
Param | Type |
---|---|
eventName | <code>'onRebuffering'</code> |
listenerFunc | <code>() => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onSeekCompleted', ...)
addListener(eventName: "onSeekCompleted", listenerFunc: (data: { position: number; }) => void) => Promise<PluginListenerHandle>
Listen for position changes
Param | Type |
---|---|
eventName | <code>'onSeekCompleted'</code> |
listenerFunc | <code>(data: { position: number; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onVideoSize', ...)
addListener(eventName: "onVideoSize", listenerFunc: (data: { width: number; height: number; }) => void) => Promise<PluginListenerHandle>
Listen for video size changes
Param | Type |
---|---|
eventName | <code>'onVideoSize'</code> |
listenerFunc | <code>(data: { width: number; height: number; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onQuality', ...)
addListener(eventName: "onQuality", listenerFunc: (data: { quality: string; }) => void) => Promise<PluginListenerHandle>
Listen for quality changes
Param | Type |
---|---|
eventName | <code>'onQuality'</code> |
listenerFunc | <code>(data: { quality: string; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
addListener('onCastStatus', ...)
addListener(eventName: "onCastStatus", listenerFunc: (data: { isActive: boolean; }) => void) => Promise<PluginListenerHandle>
Listen for cast status changes
Param | Type |
---|---|
eventName | <code>'onCastStatus'</code> |
listenerFunc | <code>(data: { isActive: boolean; }) => void</code> |
Returns: <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
Since: 1.0.0
removeAllListeners()
removeAllListeners() => Promise<void>
Remove all listeners for this plugin.
Since: 1.0.0
Interfaces
CapacitorFrame
Prop | Type |
---|---|
x | <code>number</code> |
y | <code>number</code> |
width | <code>number</code> |
height | <code>number</code> |
PluginListenerHandle
Prop | Type |
---|---|
remove | <code>() => Promise<void></code> |
Type Aliases
CapacitorIvsPlayerState
<code>"IDLE" | "BUFFERING" | "READY" | "PLAYING" | "ENDED" | "UNKNOWN"</code>
CapacitorIvsPlayerBackgroundState
<code>"PAUSED" | "PLAYING"</code>
</docgen-api>