Skip to content

wako-app/wako-capacitor-video-player

Repository files navigation

wako-capacitor-video-player

A capacitor video player

Install

npm install wako-capacitor-video-player
npx cap sync

API

echo(...)

echo(options: capEchoOptions) => Promise<capVideoPlayerResult>

Echo

Param Type
options capEchoOptions

Returns: Promise<capVideoPlayerResult>


initPlayer(...)

initPlayer(options: capVideoPlayerOptions) => Promise<capVideoPlayerResult>

Initialize a video player

Param Type
options capVideoPlayerOptions

Returns: Promise<capVideoPlayerResult>


isPlaying(...)

isPlaying(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Return if a given playerId is playing

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


play(...)

play(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Play the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


pause(...)

pause(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Pause the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


getDuration(...)

getDuration(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Get the duration of the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


getCurrentTime(...)

getCurrentTime(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Get the current time of the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


setCurrentTime(...)

setCurrentTime(options: capVideoTimeOptions) => Promise<capVideoPlayerResult>

Set the current time to seek the current video to from a given playerId

Param Type
options capVideoTimeOptions

Returns: Promise<capVideoPlayerResult>


getVolume(...)

getVolume(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Get the volume of the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


setVolume(...)

setVolume(options: capVideoVolumeOptions) => Promise<capVideoPlayerResult>

Set the volume of the current video to from a given playerId

Param Type
options capVideoVolumeOptions

Returns: Promise<capVideoPlayerResult>


getMuted(...)

getMuted(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Get the muted of the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


setMuted(...)

setMuted(options: capVideoMutedOptions) => Promise<capVideoPlayerResult>

Set the muted of the current video to from a given playerId

Param Type
options capVideoMutedOptions

Returns: Promise<capVideoPlayerResult>


setRate(...)

setRate(options: capVideoRateOptions) => Promise<capVideoPlayerResult>

Set the rate of the current video from a given playerId

Param Type
options capVideoRateOptions

Returns: Promise<capVideoPlayerResult>


getRate(...)

getRate(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>

Get the rate of the current video from a given playerId

Param Type
options capVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


stopAllPlayers()

stopAllPlayers() => Promise<capVideoPlayerResult>

Stop all players playing

Returns: Promise<capVideoPlayerResult>


showController()

showController() => Promise<capVideoPlayerResult>

Show controller

Returns: Promise<capVideoPlayerResult>


isControllerIsFullyVisible()

isControllerIsFullyVisible() => Promise<capVideoPlayerResult>

isControllerIsFullyVisible

Returns: Promise<capVideoPlayerResult>


exitPlayer()

exitPlayer() => Promise<capVideoPlayerResult>

Exit player

Returns: Promise<capVideoPlayerResult>


enableSubtitles(...)

enableSubtitles(options: capVideoSubtitlesOptions) => Promise<capVideoPlayerResult>

Enable or disable subtitles

Param Type Description
options capVideoSubtitlesOptions Object containing the enabled flag (true to enable, false to disable)

Returns: Promise<capVideoPlayerResult>


addListener('playerReady', ...)

addListener(eventName: 'playerReady', listenerFunc: PlayerReady) => Promise<PluginListenerHandle>

Listen for changes in the App's active state (whether the app is in the foreground or background)

Param Type
eventName 'playerReady'
listenerFunc PlayerReady

Returns: Promise<PluginListenerHandle>

Since: 1.0.0


addListener('playerPlay', ...)

addListener(eventName: 'playerPlay', listenerFunc: PlayerPlay) => Promise<PluginListenerHandle>
Param Type
eventName 'playerPlay'
listenerFunc PlayerPlay

Returns: Promise<PluginListenerHandle>


addListener('playerPause', ...)

addListener(eventName: 'playerPause', listenerFunc: PlayerPause) => Promise<PluginListenerHandle>
Param Type
eventName 'playerPause'
listenerFunc PlayerPause

Returns: Promise<PluginListenerHandle>


addListener('playerEnded', ...)

addListener(eventName: 'playerEnded', listenerFunc: PlayerEnded) => Promise<PluginListenerHandle>
Param Type
eventName 'playerEnded'
listenerFunc PlayerEnded

Returns: Promise<PluginListenerHandle>


addListener('playerExit', ...)

addListener(eventName: 'playerExit', listenerFunc: PlayerExit) => Promise<PluginListenerHandle>
Param Type
eventName 'playerExit'
listenerFunc PlayerExit

Returns: Promise<PluginListenerHandle>


addListener('playerTracksChanged', ...)

addListener(eventName: 'playerTracksChanged', listenerFunc: PlayerTracksChanged) => Promise<PluginListenerHandle>
Param Type
eventName 'playerTracksChanged'
listenerFunc PlayerTracksChanged

Returns: Promise<PluginListenerHandle>


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

capEchoOptions

Prop Type Description
value string String to be echoed

capVideoPlayerOptions

Prop Type Description
mode string Player mode - "fullscreen" - "embedded" (Web only)
url string The url of the video to play
subtitles { url: string; name?: string; lang?: string; }[] The subtitle(s) associated with the video as an array of objects Each object must contain: - url: the url of the subtitle file (required) - name: the name of the subtitle (optional) - lang: the language of the subtitle (optional)
preferredLanguage string The default audio language to select, if not found will select the subtitle with the same language if available
subtitleOptions SubTitleOptions SubTitle Options
playerId string Id of DIV Element parent of the player
rate number Initial playing rate
exitOnEnd boolean Exit on VideoEnd (iOS, Android) default: true
loopOnEnd boolean Loop on VideoEnd when exitOnEnd false (iOS, Android) default: false
pipEnabled boolean Picture in Picture Enable (iOS, Android) default: true
bkmodeEnabled boolean Background Mode Enable (iOS, Android) default: true
showControls boolean Show Controls Enable (iOS, Android) default: true
displayMode string Display Mode ["all", "portrait", "landscape"] (iOS, Android) default: "all"
componentTag string Component Tag or DOM Element Tag (React app)
width number Player Width (mode "embedded" only)
height number Player height (mode "embedded" only)
headers { [key: string]: string; } Headers for the request (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX)
title string Title shown in the player (Android) by Manuel García Marín (https://github.com/PhantomPainX)
smallTitle string Subtitle shown below the title in the player (Android) by Manuel García Marín (https://github.com/PhantomPainX)
accentColor string ExoPlayer Progress Bar and Spinner color (Android) by Manuel García Marín (https://github.com/PhantomPainX) Must be a valid hex color code default: #FFFFFF
chromecast boolean Chromecast enable/disable (Android) by Manuel García Marín (https://github.com/PhantomPainX) default: true
artwork string Artwork url to be shown in Chromecast player by Manuel García Marín (https://github.com/PhantomPainX) default: ""
subtitleTrackId string ID of the subtitle track to select
subtitleLocale string Locale of the subtitle track to select (if subtitleTrackId not found)
audioTrackId string ID of the audio track to select
audioLocale string Locale of the audio track to select (if audioTrackId not found)
startAtSec number Start time of the video

SubTitleOptions

Prop Type Description
foregroundColor string Foreground Color in RGBA (default rgba(255,255,255,1)
backgroundColor string Background Color in RGBA (default rgba(0,0,0,1)
fontSize number Font Size in pixels (default 16)

capVideoPlayerIdOptions

Prop Type Description
playerId string Id of DIV Element parent of the player

capVideoTimeOptions

Prop Type Description
playerId string Id of DIV Element parent of the player
seektime number Video time value you want to seek to

capVideoVolumeOptions

Prop Type Description
playerId string Id of DIV Element parent of the player
volume number Volume value between [0 - 1]

capVideoMutedOptions

Prop Type Description
playerId string Player Id
muted boolean Muted value

capVideoRateOptions

Prop Type Description
playerId string Id of DIV Element parent of the player
rate number Rate value

capVideoSubtitlesOptions

Prop Type Description
playerId string Player Id
enabled boolean Enable or disable subtitles

PluginListenerHandle

Prop Type
remove () => Promise<void>

capVideoListener

Prop Type Description
playerId string Id of DIV Element parent of the player
currentTime number Video current time when listener trigerred

capExitListener

Prop Type Description
dismiss boolean Dismiss value true or false
currentTime number Video current time when listener trigerred

TracksChangedInfo

Prop Type
fromPlayerId string
audioTrack TrackInfo
subtitleTrack TrackInfo

TrackInfo

Prop Type
id string
language string
label string
codecs string
bitrate number
channelCount number
sampleRate number
containerMimeType string
sampleMimeType string

Type Aliases

PlayerReady

(event: capVideoListener): void

PlayerPlay

(event: capVideoListener): void

PlayerPause

(event: capVideoListener): void

PlayerEnded

(event: capVideoListener): void

PlayerExit

(event: capExitListener): void

PlayerTracksChanged

(event: TracksChangedInfo): void

About

A capacitor video player for wako.app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published