Home

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> </docgen-index> <docgen-api> <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

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>
ParamType
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>
ParamType
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>
ParamType
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>
ParamType
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

ParamTypeDescription
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>
ParamType
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>
ParamType
options<code>{ muted?: boolean; }</code>

getMute()

getMute() => Promise<{ mute: boolean; }>

Returns: <code>Promise<{ mute: boolean; }></code>


setQuality(...)

setQuality(options?: { quality: string; } | undefined) => Promise<void>
ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

ParamType
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

PropType
x<code>number</code>
y<code>number</code>
width<code>number</code>
height<code>number</code>

PluginListenerHandle

PropType
remove<code>() => Promise<void></code>

Type Aliases

CapacitorIvsPlayerState

<code>"IDLE" | "BUFFERING" | "READY" | "PLAYING" | "ENDED" | "UNKNOWN"</code>

CapacitorIvsPlayerBackgroundState

<code>"PAUSED" | "PLAYING"</code>

</docgen-api>

Credits

This plugin was created originally for Kick.com by Capgo