Skip to content

Getting Started

Terminal window
bun add @capgo/capacitor-jw-player
bunx cap sync
import { JwPlayer } from '@capgo/capacitor-jw-player';

Initialize the JW Player

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.initialize({} as { licenseKey: string; playerUrl?: string });

Play a video

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.play({} as { mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean });

Pause the currently playing media

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.pause();

Resume the currently paused media

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.resume();

Stop the currently playing media

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.stop();

Seek to a specific position in the currently playing media

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.seekTo({} as { time: number });

Set the volume level

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setVolume({} as { volume: number });

Get the current position in the media

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getPosition();

Get the current player state

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getState();

Set the playback speed

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setSpeed({} as { speed: number });

Set the current item in the playlist by index

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setPlaylistIndex({} as { index: number });

Load a playlist

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylist({} as { playlistUrl: string });

Load a playlist with items

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylistWithItems({} as { playlist: any[] });

Get available audio tracks

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getAudioTracks();

Get the current audio track

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getCurrentAudioTrack();

Set the current audio track

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentAudioTrack({} as { index: number });

Get the available captions/subtitles

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getCaptions();

Get the current captions/subtitles track

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getCurrentCaptions();

Set the current captions/subtitles track

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentCaptions({} as { index: number });

Get the current playlist

import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.currentPlaylist();

This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.

If you are using Getting Started to plan dashboard and API operations, connect it with Using @capgo/capacitor-jw-player for the native capability in Using @capgo/capacitor-jw-player, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.