Skip to content

Latest commit

 

History

History
167 lines (100 loc) · 4.97 KB

README.md

File metadata and controls

167 lines (100 loc) · 4.97 KB

capacitor-video-player

Capacitor plugin for video playing, backed up by FFMPEG for audio decoding of unsupported formats.

Install

npm install capacitor-video-player
npx cap sync

API

initPlayer()

initPlayer() => Promise<capVideoPlayerResult>

Initialize a video player

Returns: Promise<capVideoPlayerResult>


isPlaying()

isPlaying() => Promise<capVideoPlayerResult>

Return if a given playerId is playing

Returns: Promise<capVideoPlayerResult>


setVideoUrl(...)

setVideoUrl(options: { url: string; }) => Promise<capVideoPlayerResult>

Play the current video from a given playerId

Param Type
options { url: string; }

Returns: Promise<capVideoPlayerResult>


playerPlay()

playerPlay() => Promise<void>

playerPause()

playerPause() => Promise<capVideoPlayerResult>

Pause the current video from a given playerId

Returns: Promise<capVideoPlayerResult>


playerStop()

playerStop() => Promise<capVideoPlayerResult>

Returns: Promise<capVideoPlayerResult>


exitPlayer()

exitPlayer() => Promise<capVideoPlayerResult>

Exit player

Returns: Promise<capVideoPlayerResult>


addListener('CapVideoPlayerBuffering' | 'CapVideoPlayerIdle' | 'CapVideoPlayerPlaying' | 'CapVideoPlayerReady' | 'CapVideoPlayerError' | 'CapVideoPlayerEnd', ...)

addListener(eventName: 'CapVideoPlayerBuffering' | 'CapVideoPlayerIdle' | 'CapVideoPlayerPlaying' | 'CapVideoPlayerReady' | 'CapVideoPlayerError' | 'CapVideoPlayerEnd', listenerFunc: (event: any) => void) => Promise<PluginListenerHandle>

Add event listeners for player events.

Param Type Description
eventName 'CapVideoPlayerBuffering' | 'CapVideoPlayerIdle' | 'CapVideoPlayerPlaying' | 'CapVideoPlayerReady' | 'CapVideoPlayerError' | 'CapVideoPlayerEnd' The name of the event to listen for.
listenerFunc (event: any) => void The function to call when the event is triggered.

Returns: Promise<PluginListenerHandle>


removeAllListeners()

removeAllListeners() => Promise<void>

Interfaces

capVideoPlayerResult

Prop Type Description
result boolean result set to true when successful else false
method string method name
value any value returned
message string message string

PluginListenerHandle

Prop Type
remove () => Promise<void>