An open API service indexing awesome lists of open source software.

https://github.com/cap-go/capacitor-ivs-player

Capacitor plugin Native Ivs player Android and IOS.
https://github.com/cap-go/capacitor-ivs-player

capacitor capacitor-plugin

Last synced: 8 days ago
JSON representation

Capacitor plugin Native Ivs player Android and IOS.

Awesome Lists containing this project

README

          

# @capgo/capacitor-ivs-player
Capgo - Instant updates for Capacitor


➡️ Get Instant updates for your App with Capgo


Missing a feature? We’ll build the plugin for you 💪


[Ivs player](https://docs.aws.amazon.com/ivs/latest/userguide/player.html) for Capacitor app Android and IOS.

## Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/ivs-player/

## Compatibility

| Plugin version | Capacitor compatibility | Maintained |
| -------------- | ----------------------- | ---------- |
| v8.\*.\* | v8.\*.\* | ✅ |
| v7.\*.\* | v7.\*.\* | On demand |
| v6.\*.\* | v6.\*.\* | ❌ |
| v5.\*.\* | v5.\*.\* | ❌ |

> **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

## Install

```bash
npm install @capgo/capacitor-ivs-player
npx cap sync
```

## API

* [`create(...)`](#create)
* [`start()`](#start)
* [`cast()`](#cast)
* [`getCastStatus()`](#getcaststatus)
* [`pause()`](#pause)
* [`delete()`](#delete)
* [`getUrl()`](#geturl)
* [`getState()`](#getstate)
* [`setPlayerPosition(...)`](#setplayerposition)
* [`getPlayerPosition()`](#getplayerposition)
* [`setAutoQuality(...)`](#setautoquality)
* [`getAutoQuality()`](#getautoquality)
* [`setPip(...)`](#setpip)
* [`getPip()`](#getpip)
* [`setFrame(...)`](#setframe)
* [`getFrame()`](#getframe)
* [`setBackgroundState(...)`](#setbackgroundstate)
* [`getBackgroundState()`](#getbackgroundstate)
* [`setMute(...)`](#setmute)
* [`getMute()`](#getmute)
* [`setQuality(...)`](#setquality)
* [`getQuality()`](#getquality)
* [`getQualities()`](#getqualities)
* [`getPluginVersion()`](#getpluginversion)
* [`addListener('startPip', ...)`](#addlistenerstartpip-)
* [`addListener('stopPip', ...)`](#addlistenerstoppip-)
* [`addListener('expandPip', ...)`](#addlistenerexpandpip-)
* [`addListener('closePip', ...)`](#addlistenerclosepip-)
* [`addListener('onState', ...)`](#addlisteneronstate-)
* [`addListener('onCues', ...)`](#addlisteneroncues-)
* [`addListener('onDuration', ...)`](#addlisteneronduration-)
* [`addListener('onError', ...)`](#addlisteneronerror-)
* [`addListener('onRebuffering', ...)`](#addlisteneronrebuffering-)
* [`addListener('onSeekCompleted', ...)`](#addlisteneronseekcompleted-)
* [`addListener('onVideoSize', ...)`](#addlisteneronvideosize-)
* [`addListener('onQuality', ...)`](#addlisteneronquality-)
* [`addListener('onCastStatus', ...)`](#addlisteneroncaststatus-)
* [`removeAllListeners()`](#removealllisteners)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

### create(...)

```typescript
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
```

| 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()

```typescript
start() => Promise
```

--------------------

### cast()

```typescript
cast() => Promise
```

--------------------

### getCastStatus()

```typescript
getCastStatus() => Promise<{ isActive: boolean; }>
```

**Returns:** Promise<{ isActive: boolean; }>

--------------------

### pause()

```typescript
pause() => Promise
```

--------------------

### delete()

```typescript
delete() => Promise
```

--------------------

### getUrl()

```typescript
getUrl() => Promise<{ url: string; }>
```

**Returns:** Promise<{ url: string; }>

--------------------

### getState()

```typescript
getState() => Promise<{ state: CapacitorIvsPlayerState; }>
```

**Returns:** Promise<{ state: CapacitorIvsPlayerState; }>

--------------------

### setPlayerPosition(...)

```typescript
setPlayerPosition(options?: { toBack: boolean; } | undefined) => Promise
```

| Param | Type |
| ------------- | --------------------------------- |
| **`options`** | { toBack: boolean; } |

--------------------

### getPlayerPosition()

```typescript
getPlayerPosition() => Promise<{ toBack: boolean; }>
```

**Returns:** Promise<{ toBack: boolean; }>

--------------------

### setAutoQuality(...)

```typescript
setAutoQuality(options?: { autoQuality?: boolean | undefined; } | undefined) => Promise
```

| Param | Type |
| ------------- | --------------------------------------- |
| **`options`** | { autoQuality?: boolean; } |

--------------------

### getAutoQuality()

```typescript
getAutoQuality() => Promise<{ autoQuality: boolean; }>
```

**Returns:** Promise<{ autoQuality: boolean; }>

--------------------

### setPip(...)

```typescript
setPip(options?: { pip?: boolean | undefined; } | undefined) => Promise
```

| Param | Type |
| ------------- | ------------------------------- |
| **`options`** | { pip?: boolean; } |

--------------------

### getPip()

```typescript
getPip() => Promise<{ pip: boolean; }>
```

**Returns:** Promise<{ pip: boolean; }>

--------------------

### setFrame(...)

```typescript
setFrame(options?: { x?: number | undefined; y?: number | undefined; width?: number | undefined; height?: number | undefined; } | undefined) => Promise
```

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()

```typescript
getFrame() => Promise
```

**Returns:** Promise<CapacitorFrame>

--------------------

### setBackgroundState(...)

```typescript
setBackgroundState(options: { backgroundState: CapacitorIvsPlayerBackgroundState; }) => Promise
```

| Param | Type |
| ------------- | --------------------------------------------------------------------------------------------------------------------- |
| **`options`** | { backgroundState: CapacitorIvsPlayerBackgroundState; } |

--------------------

### getBackgroundState()

```typescript
getBackgroundState() => Promise<{ backgroundState: CapacitorIvsPlayerBackgroundState; }>
```

**Returns:** Promise<{ backgroundState: CapacitorIvsPlayerBackgroundState; }>

--------------------

### setMute(...)

```typescript
setMute(options?: { muted?: boolean | undefined; } | undefined) => Promise
```

| Param | Type |
| ------------- | --------------------------------- |
| **`options`** | { muted?: boolean; } |

--------------------

### getMute()

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

**Returns:** Promise<{ mute: boolean; }>

--------------------

### setQuality(...)

```typescript
setQuality(options?: { quality: string; } | undefined) => Promise
```

| Param | Type |
| ------------- | --------------------------------- |
| **`options`** | { quality: string; } |

--------------------

### getQuality()

```typescript
getQuality() => Promise<{ quality: string; }>
```

**Returns:** Promise<{ quality: string; }>

--------------------

### getQualities()

```typescript
getQualities() => Promise<{ qualities: string[]; }>
```

**Returns:** Promise<{ qualities: string[]; }>

--------------------

### getPluginVersion()

```typescript
getPluginVersion() => Promise<{ version: string; }>
```

Get the native Capacitor plugin version

**Returns:** Promise<{ version: string; }>

--------------------

### addListener('startPip', ...)

```typescript
addListener(eventName: 'startPip', listenerFunc: () => void) => Promise
```

Listen for start pip

| Param | Type |
| ------------------ | -------------------------- |
| **`eventName`** | 'startPip' |
| **`listenerFunc`** | () => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('stopPip', ...)

```typescript
addListener(eventName: 'stopPip', listenerFunc: () => void) => Promise
```

Listen for stop pip

| Param | Type |
| ------------------ | -------------------------- |
| **`eventName`** | 'stopPip' |
| **`listenerFunc`** | () => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('expandPip', ...)

```typescript
addListener(eventName: 'expandPip', listenerFunc: () => void) => Promise
```

Listen for expend pip

| Param | Type |
| ------------------ | -------------------------- |
| **`eventName`** | 'expandPip' |
| **`listenerFunc`** | () => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('closePip', ...)

```typescript
addListener(eventName: 'closePip', listenerFunc: () => void) => Promise
```

Listen for close pip

| Param | Type |
| ------------------ | -------------------------- |
| **`eventName`** | 'closePip' |
| **`listenerFunc`** | () => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onState', ...)

```typescript
addListener(eventName: 'onState', listenerFunc: (data: { state: CapacitorIvsPlayerState; }) => void) => Promise
```

Listen for state changes

| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------------------------------- |
| **`eventName`** | 'onState' |
| **`listenerFunc`** | (data: { state: CapacitorIvsPlayerState; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onCues', ...)

```typescript
addListener(eventName: 'onCues', listenerFunc: (data: { cues: string; }) => void) => Promise
```

Listen for cue changes

| Param | Type |
| ------------------ | ------------------------------------------------- |
| **`eventName`** | 'onCues' |
| **`listenerFunc`** | (data: { cues: string; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onDuration', ...)

```typescript
addListener(eventName: 'onDuration', listenerFunc: (data: { duration: number; }) => void) => Promise
```

Listen for duration changes

| Param | Type |
| ------------------ | ----------------------------------------------------- |
| **`eventName`** | 'onDuration' |
| **`listenerFunc`** | (data: { duration: number; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onError', ...)

```typescript
addListener(eventName: 'onError', listenerFunc: (data: { error: string; }) => void) => Promise
```

Listen for errors

| Param | Type |
| ------------------ | -------------------------------------------------- |
| **`eventName`** | 'onError' |
| **`listenerFunc`** | (data: { error: string; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onRebuffering', ...)

```typescript
addListener(eventName: 'onRebuffering', listenerFunc: () => void) => Promise
```

Listen for rebuffering

| Param | Type |
| ------------------ | ---------------------------- |
| **`eventName`** | 'onRebuffering' |
| **`listenerFunc`** | () => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onSeekCompleted', ...)

```typescript
addListener(eventName: 'onSeekCompleted', listenerFunc: (data: { position: number; }) => void) => Promise
```

Listen for position changes

| Param | Type |
| ------------------ | ----------------------------------------------------- |
| **`eventName`** | 'onSeekCompleted' |
| **`listenerFunc`** | (data: { position: number; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onVideoSize', ...)

```typescript
addListener(eventName: 'onVideoSize', listenerFunc: (data: { width: number; height: number; }) => void) => Promise
```

Listen for video size changes

| Param | Type |
| ------------------ | ------------------------------------------------------------------ |
| **`eventName`** | 'onVideoSize' |
| **`listenerFunc`** | (data: { width: number; height: number; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onQuality', ...)

```typescript
addListener(eventName: 'onQuality', listenerFunc: (data: { quality: string; }) => void) => Promise
```

Listen for quality changes

| Param | Type |
| ------------------ | ---------------------------------------------------- |
| **`eventName`** | 'onQuality' |
| **`listenerFunc`** | (data: { quality: string; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### addListener('onCastStatus', ...)

```typescript
addListener(eventName: 'onCastStatus', listenerFunc: (data: { isActive: boolean; }) => void) => Promise
```

Listen for cast status changes

| Param | Type |
| ------------------ | ------------------------------------------------------ |
| **`eventName`** | 'onCastStatus' |
| **`listenerFunc`** | (data: { isActive: boolean; }) => void |

**Returns:** Promise<PluginListenerHandle>

**Since:** 1.0.0

--------------------

### removeAllListeners()

```typescript
removeAllListeners() => Promise
```

Remove all listeners for this plugin.

**Since:** 1.0.0

--------------------

### Interfaces

#### CapacitorFrame

| Prop | Type |
| ------------ | ------------------- |
| **`x`** | number |
| **`y`** | number |
| **`width`** | number |
| **`height`** | number |

#### PluginListenerHandle

| Prop | Type |
| ------------ | ----------------------------------------- |
| **`remove`** | () => Promise<void> |

### Type Aliases

#### CapacitorIvsPlayerState

'IDLE' | 'BUFFERING' | 'READY' | 'PLAYING' | 'ENDED' | 'UNKNOWN'

#### CapacitorIvsPlayerBackgroundState

'PAUSED' | 'PLAYING'

# Credits

This plugin was created originally for [Kick.com](https://kick.com) by [Capgo](https://capgo.app)