The most complete doc is available here: https://capgo.app/docs/plugins/video-player/
npm install @capgo/capacitor-video-player
npx cap syncinitPlayer(...)isPlaying(...)play(...)pause(...)getDuration(...)getCurrentTime(...)setCurrentTime(...)getVolume(...)setVolume(...)getMuted(...)setMuted(...)setRate(...)getRate(...)stopAllPlayers()showController()isControllerIsFullyVisible()exitPlayer()- Interfaces
initPlayer(options: capVideoPlayerOptions) => Promise<capVideoPlayerResult>Initialize a video player
| Param | Type |
|---|---|
options |
capVideoPlayerOptions |
Returns: Promise<capVideoPlayerResult>
isPlaying(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Return if a given playerId is playing
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
play(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Play the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
pause(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Pause the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
getDuration(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Get the duration of the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
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(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(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Get the volume of the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
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(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Get the muted of the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
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(options: capVideoRateOptions) => Promise<capVideoPlayerResult>Set the rate of the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoRateOptions |
Returns: Promise<capVideoPlayerResult>
getRate(options: capVideoPlayerIdOptions) => Promise<capVideoPlayerResult>Get the rate of the current video from a given playerId
| Param | Type |
|---|---|
options |
capVideoPlayerIdOptions |
Returns: Promise<capVideoPlayerResult>
stopAllPlayers() => Promise<capVideoPlayerResult>Stop all players playing
Returns: Promise<capVideoPlayerResult>
showController() => Promise<capVideoPlayerResult>Show controller
Returns: Promise<capVideoPlayerResult>
isControllerIsFullyVisible() => Promise<capVideoPlayerResult>isControllerIsFullyVisible
Returns: Promise<capVideoPlayerResult>
exitPlayer() => Promise<capVideoPlayerResult>Exit player
Returns: Promise<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 |
| Prop | Type | Description |
|---|---|---|
mode |
string |
Player mode - "fullscreen" - "embedded" (Web only) |
url |
string |
The url of the video to play |
subtitle |
string |
The url of subtitle associated with the video |
language |
string |
The language of subtitle see https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers |
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: "" |
| 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) |
| Method | Signature | Description |
|---|---|---|
| getPluginVersion | () => Promise<{ version: string; }> | Get the native Capacitor plugin version |
| Prop | Type | Description |
|---|---|---|
playerId |
string |
Id of DIV Element parent of the player |
| Prop | Type | Description |
|---|---|---|
playerId |
string |
Id of DIV Element parent of the player |
seektime |
number |
Video time value you want to seek to |
| Prop | Type | Description |
|---|---|---|
playerId |
string |
Id of DIV Element parent of the player |
volume |
number |
Volume value between [0 - 1] |
| Prop | Type | Description |
|---|---|---|
playerId |
string |
Id of DIV Element parent of the player |
muted |
boolean |
Muted value true or false |
| Prop | Type | Description |
|---|---|---|
playerId |
string |
Id of DIV Element parent of the player |
rate |
number |
Rate value |