Prise en main
Copiez un prompt de configuration incluant les étapes d'installation et le guide markdown complet pour ce plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-jw-player`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/jw-player/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installer
Section intitulée « Installation »Vous pouvez utiliser notre configuration assistée par IA pour installer le plugin. Ajoutez les skills Capgo à votre outil d'IA avec la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsUtilisez ensuite le prompt suivant :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-jw-player` plugin in my project.Si vous préférez une installation manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques à chaque plateforme ci-dessous :
npm install @capgo/capacitor-jw-playernpx cap syncImporter
Section intitulée « Import »import { JwPlayer } from '@capgo/capacitor-jw-player';Démarrage rapide
Section intitulée « Démarrage rapide »import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.initialize({ licenseKey: 'YOUR_JW_LICENSE' });await JwPlayer.play({ mediaUrl: 'https://cdn.example.com/stream.m3u8', mediaType: 'video' });Erreurs courantes
Section intitulée « Erreurs courantes »- Licence : une licence JW valide est requise avant
initialize(). - DRM : transmettez les configs DRM depuis votre backend, n'intégrez jamais de secrets.
- Audio : coordonnez-vous avec
@capgo/capacitor-audiosessionsur iOS.
Aperçu de API
Section intitulée « Aperçu API »initialize
Section intitulée « initialize »Initialiser le JW Player
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.initialize({ licenseKey: 'license-key-123' });Lire une vidéo
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.play({ mediaUrl: 'https://example.com', mediaType: 'video',});Mettre en pause le média en cours
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.pause();Reprendre le média en pause
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.resume();Arrêter le média en cours de lecture
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.stop();Aller à une position précise du média en cours
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.seekTo({ time: 10 });setVolume
Section intitulée « setVolume »Régler le niveau du volume
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setVolume({ volume: 0.5 });getPosition
Section intitulée « getPosition »Obtenir la position actuelle du média
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getPosition();console.log(result);getState
Section intitulée « getState »Obtenir l'état actuel du lecteur
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getState();console.log(result);setSpeed
Section intitulée « setSpeed »Régler la vitesse de lecture
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setSpeed({ speed: 1 });setPlaylistIndex
Section intitulée « setPlaylistIndex »Définir l'élément actuel de la playlist par son index
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setPlaylistIndex({ index: 1 });loadPlaylist
Section intitulée « loadPlaylist »Charger une playlist
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylist({ playlistUrl: 'https://example.com' });loadPlaylistWithItems
Section intitulée « loadPlaylistWithItems »Charger une playlist avec des éléments
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylistWithItems({ playlist: [] });getAudioTracks
Section intitulée « getAudioTracks »Récupérer les pistes audio disponibles
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getAudioTracks();console.log(result);getCurrentAudioTrack
Section intitulée « getCurrentAudioTrack »Récupérer la piste audio actuelle
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getCurrentAudioTrack();console.log(result);setCurrentAudioTrack
Section intitulée « setCurrentAudioTrack »Définir la piste audio actuelle
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentAudioTrack({ index: 1 });getCaptions
Section intitulée « getCaptions »Récupérer les sous-titres disponibles
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getCaptions();console.log(result);getCurrentCaptions
Section intitulée « getCurrentCaptions »Récupérer la piste de sous-titres actuelle
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getCurrentCaptions();console.log(result);setCurrentCaptions
Section intitulée « setCurrentCaptions »Définir la piste de sous-titres actuelle
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentCaptions({ index: 1 });currentPlaylist
Section intitulée « currentPlaylist »Récupérer la playlist actuelle
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.currentPlaylist();console.log(result);Source de vérité
Section intitulée « Source de vérité »Cette page est générée à partir de src/definitions.ts. Relancez la synchronisation lorsque l’API public change en amont.
Continuer depuis Getting Started
Section intitulée « Continuer après Prise en main »Si vous utilisez Prise en main pour planifier les opérations du dashboard et de API, connectez-l’avec Utilisation de @capgo/capacitor-jw-player pour la capacité native dans l'utilisation de @capgo/capacitor-jw-player, Aperçu de API pour les détails d'implémentation dans « Vue d'ensemble de API », Introduction pour les détails d'implémentation dans l'introduction, Clés API pour les détails d'implémentation dans « Clés API », et Appareils pour les détails d'implémentation dans Devices.