@capgo/capacitor-video-player

June 19, 2026 · View on GitHub

Capgo - Instant updates for Capacitor

➡️ Get Instant updates for your App with Capgo

Missing a feature? We’ll build the plugin for you 💪

Native video playback for Capacitor apps

Documentation

The most complete doc is available here: https://capgo.app/docs/plugins/video-player/

Compatibility

Plugin versionCapacitor compatibilityMaintained
v8.*.*v8.*.*
v7.*.*v7.*.*On demand
v6.*.*v6.*.*
v5.*.*v5.*.*

Note: The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.

Install

You can use our AI-Assisted Setup to install the plugin. Add the Capgo skills to your AI tool using the following command:

npx skills add https://github.com/cap-go/capacitor-skills --skill capacitor-plugins

Then use the following prompt:

Use the `capacitor-plugins` skill from `cap-go/capacitor-skills` to install the `@capgo/capacitor-video-player` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

bun add @capgo/capacitor-video-player
bunx cap sync

iOS Chromecast setup

iOS Chromecast uses the Google Cast SDK default media receiver. When chromecast is enabled, the plugin adds a Cast button over the fullscreen iOS player, loads the current media on the selected receiver, and keeps plugin play/pause/seek/volume calls pointed at the active Cast session.

For Cast discovery on iOS, add local network keys to your app Info.plist.

<key>NSBonjourServices</key>
<array>
  <string>_googlecast._tcp</string>
  <string>_CC1AD845._googlecast._tcp</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>$(PRODUCT_NAME) uses the local network to discover Cast-enabled devices on your WiFi network.</string>
await VideoPlayer.initPlayer({
  playerId: 'fullscreen',
  mode: 'fullscreen',
  url: 'https://example.com/video.mp4',
  title: 'Video title',
  smallTitle: 'Video subtitle',
  artwork: 'https://example.com/poster.jpg',
  chromecast: true,
});

Supported Features

FeatureiOSAndroidWeb
Fullscreen native video player
Embedded web video player
Picture in Picture
Subtitles
DRM-protected playback
Chromecast sender playback

Chromecast (Android)

Chromecast is supported on Android in fullscreen mode. Enable it with the chromecast option. When a Cast session starts, the plugin loads the same media URL on the receiver, keeps the current playback position, and routes play, pause, seek, and timeline controls through the Cast session.

await VideoPlayer.initPlayer({
  mode: 'fullscreen',
  playerId: 'main-player',
  url: 'https://example.com/video.m3u8',
  title: 'Video title',
  smallTitle: 'Optional subtitle',
  artwork: 'https://example.com/artwork.jpg',
  chromecast: true,
  showControls: true,
});

Chromecast Options

OptionTypeDefaultDescription
chromecastbooleantrueShows the Android Cast button and enables sender playback.
titlestring""Title shown in the sender controls and receiver metadata.
smallTitlestring""Subtitle shown in the sender controls and metadata.
artworkstring""Image URL used for Cast metadata and sender Cast artwork.

Requirements and Notes

  • The media URL must be reachable by the Chromecast device, not only by the Android app.
  • Cast support depends on the receiver app and device media support. MP4, HLS, DASH, and SmoothStreaming streams are mapped to Cast-compatible MIME types by the plugin.
  • Widevine DRM metadata is forwarded to the Cast media item. DRM-protected streams may still require a receiver that supports your license server and DRM flow.
  • Request headers used by the Android local player are not automatically available to the Chromecast receiver. Use public URLs, signed URLs, cookies supported by your receiver, or a custom receiver for secured media.

Android Picture in Picture

Picture in Picture on Android requires your app activity to declare PiP support in android/app/src/main/AndroidManifest.xml:

<activity
  android:name=".MainActivity"
  android:supportsPictureInPicture="true"
  android:launchMode="singleTask"
  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
  ...>
</activity>

launchMode="singleTask" and the configChanges flags prevent the player activity from being recreated when entering or leaving PiP.

API

initPlayer(...)

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

Initialize a video player

ParamType
optionscapVideoPlayerOptions

Returns: Promise<capVideoPlayerResult>


isPlaying(...)

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

Return if a given playerId is playing

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


play(...)

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

Play the current video from a given playerId

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


pause(...)

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

Pause the current video from a given playerId

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


getDuration(...)

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

Get the duration of the current video from a given playerId

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


getCurrentTime(...)

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

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

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


setCurrentTime(...)

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

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

ParamType
optionscapVideoTimeOptions

Returns: Promise<capVideoPlayerResult>


getVolume(...)

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

Get the volume of the current video from a given playerId

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


setVolume(...)

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

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

ParamType
optionscapVideoVolumeOptions

Returns: Promise<capVideoPlayerResult>


getMuted(...)

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

Get the muted of the current video from a given playerId

ParamType
optionscapVideoPlayerIdOptions

Returns: Promise<capVideoPlayerResult>


setMuted(...)

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

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

ParamType
optionscapVideoMutedOptions

Returns: Promise<capVideoPlayerResult>


setRate(...)

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

Set the rate of the current video from a given playerId

ParamType
optionscapVideoRateOptions

Returns: Promise<capVideoPlayerResult>


getRate(...)

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

Get the rate of the current video from a given playerId

ParamType
optionscapVideoPlayerIdOptions

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>


Interfaces

capVideoPlayerResult

PropTypeDescription
resultbooleanresult set to true when successful else false
methodstringmethod name
valueanyvalue returned
messagestringmessage string

capVideoPlayerOptions

PropTypeDescription
modestringPlayer mode - "fullscreen" - "embedded" (Web only)
urlstringThe url of the video to play
subtitlestringThe url of subtitle associated with the video
languagestringThe language of subtitle see https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers
subtitleOptionsSubTitleOptionsSubTitle Options
playerIdstringId of DIV Element parent of the player
ratenumberInitial playing rate
exitOnEndbooleanExit on VideoEnd (iOS, Android) default: true
loopOnEndbooleanLoop on VideoEnd when exitOnEnd false (iOS, Android) default: false
pipEnabledbooleanPicture in Picture Enable (iOS, Android) default: true
bkmodeEnabledbooleanBackground Mode Enable (iOS, Android) default: true
showControlsbooleanShow Controls Enable (iOS, Android) default: true
displayModestringDisplay Mode ["all", "portrait", "landscape"] (iOS, Android) default: "all"
componentTagstringComponent Tag or DOM Element Tag (React app)
widthnumberPlayer Width (mode "embedded" only)
heightnumberPlayer height (mode "embedded" only)
headers{ [key: string]: string; }Headers for the request (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX)
titlestringTitle shown in the player and Chromecast metadata (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX)
smallTitlestringSubtitle shown below the title in the player and Chromecast metadata (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX)
accentColorstringExoPlayer 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
chromecastbooleanChromecast enable/disable (iOS, Android) iOS requires Google Cast SDK setup and local network Info.plist keys. by Manuel García Marín (https://github.com/PhantomPainX) default: true
artworkstringArtwork url to be shown in Chromecast player (iOS, Android) by Manuel García Marín (https://github.com/PhantomPainX) default: ""
drmDrmOptionsDRM configuration for protected content (iOS: FairPlay, Android: Widevine)

SubTitleOptions

PropTypeDescription
foregroundColorstringForeground Color in RGBA (default rgba(255,255,255,1)
backgroundColorstringBackground Color in RGBA (default rgba(0,0,0,1)
fontSizenumberFont Size in pixels (default 16)
MethodSignatureDescription
getPluginVersion() => Promise<{ version: string; }>Get the native Capacitor plugin version

DrmOptions

PropTypeDescription
fairplayFairPlayDrmOptionsFairPlay DRM configuration (iOS)
playreadyPlayreadyDrmOptionsPlayReady DRM configuration
widevineWidevineDrmOptionsWidevine DRM configuration (Android)

FairPlayDrmOptions

PropTypeDescription
certificateUrlstringThe URL to fetch the FairPlay certificate
contentKeySpcUrlstringThe URL to send the SPC and receive the CKC license (FairPlay license server URL)

PlayreadyDrmOptions

PropTypeDescription
certificateUrlstringThe URL to fetch the PlayReady license

WidevineDrmOptions

PropTypeDescription
certificateUrlstringThe URL to fetch the Widevine license

capVideoPlayerIdOptions

PropTypeDescription
playerIdstringId of DIV Element parent of the player

capVideoTimeOptions

PropTypeDescription
playerIdstringId of DIV Element parent of the player
seektimenumberVideo time value you want to seek to

capVideoVolumeOptions

PropTypeDescription
playerIdstringId of DIV Element parent of the player
volumenumberVolume value between [0 - 1]

capVideoMutedOptions

PropTypeDescription
playerIdstringId of DIV Element parent of the player
mutedbooleanMuted value true or false

capVideoRateOptions

PropTypeDescription
playerIdstringId of DIV Element parent of the player
ratenumberRate value