Passer au contenu

Getting Started

Ce contenu n'est pas encore disponible dans votre langue.

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.