Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/Cap-go/ivs-player

Native Ivs player for Capacitor app Android and IOS.
https://github.com/Cap-go/ivs-player

capacitor

Last synced: 3 months ago
JSON representation

Native Ivs player for Capacitor app Android and IOS.

Awesome Lists containing this project

README

        

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


Check out: Capgo — live updates for capacitor


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

## Install

```bash
npm install @capgo/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)