Capacitor plugin for video playing, backed up by FFMPEG for audio decoding of unsupported formats.
npm install capacitor-video-player
npx cap sync
initPlayer()
isPlaying()
setVideoUrl(...)
playerPlay()
playerPause()
playerStop()
exitPlayer()
addListener('CapVideoPlayerBuffering' | 'CapVideoPlayerIdle' | 'CapVideoPlayerPlaying' | 'CapVideoPlayerReady' | 'CapVideoPlayerError' | 'CapVideoPlayerEnd', ...)
removeAllListeners()
- Interfaces
initPlayer() => Promise<capVideoPlayerResult>
Initialize a video player
Returns: Promise<capVideoPlayerResult>
isPlaying() => Promise<capVideoPlayerResult>
Return if a given playerId is playing
Returns: Promise<capVideoPlayerResult>
setVideoUrl(options: { url: string; }) => Promise<capVideoPlayerResult>
Play the current video from a given playerId
Param | Type |
---|---|
options |
{ url: string; } |
Returns: Promise<capVideoPlayerResult>
playerPlay() => Promise<void>
playerPause() => Promise<capVideoPlayerResult>
Pause the current video from a given playerId
Returns: Promise<capVideoPlayerResult>
playerStop() => Promise<capVideoPlayerResult>
Returns: Promise<capVideoPlayerResult>
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() => Promise<void>
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 |
Prop | Type |
---|---|
remove |
() => Promise<void> |