はじめに
このプラグインのインストール手順と完全なMarkdownガイドを含むセットアッププロンプトをコピー
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.
インストール
「Install」セクションAIアシストセットアップを使ってプラグインをインストールできます。以下のコマンドで、お使いのAIツールに Capgo スキルを追加してください:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用します:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-jw-player` plugin in my project.手動セットアップを希望する場合は、以下のコマンドでプラグインをインストールし、下記のプラットフォーム別の手順に従ってください:
npm install @capgo/capacitor-jw-playernpx cap syncインポート
「Import」セクションimport { JwPlayer } from '@capgo/capacitor-jw-player';クイックスタート
「Quick start」セクション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' });よくある落とし穴
「Common pitfalls」セクション- ライセンス:事前に有効なJWライセンスが必要です
initialize(). - DRM:DRM設定はバックエンドから渡し、シークレットは絶対に埋め込まないでください。
- オーディオ:〜と連携してください
@capgo/capacitor-audiosession同様に開きます。
API の概要
「API 概要」セクションinitialize
「initialize」セクションJW Playerを初期化する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.initialize({ licenseKey: 'license-key-123' });play
セクション「play」動画を再生する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.play({ mediaUrl: 'https://example.com', mediaType: 'video',});pause
「pause」セクション再生中のメディアを一時停止する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.pause();resume
「resume」セクション一時停止中のメディアを再生
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.resume();stop
「stop」セクション再生中のメディアを停止
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.stop();seekTo
「seekTo」セクション再生中のメディアを指定した位置にシーク
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.seekTo({ time: 10 });setVolume
「setVolume」セクション音量を設定
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setVolume({ volume: 0.5 });getPosition
「getPosition」セクションメディアの現在の再生位置を取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getPosition();console.log(result);getState
「getState」セクション現在のプレイヤーの状態を取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getState();console.log(result);setSpeed
「setSpeed」セクション再生速度を設定する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setSpeed({ speed: 1 });setPlaylistIndex
「setPlaylistIndex」セクションインデックスを指定してプレイリストの現在のアイテムを設定する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setPlaylistIndex({ index: 1 });loadPlaylist
「loadPlaylist」セクションプレイリストをロードする
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylist({ playlistUrl: 'https://example.com' });loadPlaylistWithItems
「loadPlaylistWithItems」セクションアイテムを含むプレイリストをロードする
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylistWithItems({ playlist: [] });getAudioTracks
「getAudioTracks」セクション利用可能なオーディオトラックを取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getAudioTracks();console.log(result);getCurrentAudioTrack
「getCurrentAudioTrack」セクション現在のオーディオトラックを取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getCurrentAudioTrack();console.log(result);setCurrentAudioTrack
「setCurrentAudioTrack」セクション現在のオーディオトラックを設定する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentAudioTrack({ index: 1 });getCaptions
「getCaptions」セクション利用可能なキャプション/字幕を取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getCaptions();console.log(result);getCurrentCaptions
「getCurrentCaptions」セクション現在のキャプション/字幕トラックを取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.getCurrentCaptions();console.log(result);setCurrentCaptions
「setCurrentCaptions」セクション現在のキャプション/字幕トラックを設定する
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentCaptions({ index: 1 });currentPlaylist
「currentPlaylist」セクション現在のプレイリストを取得する
import { JwPlayer } from '@capgo/capacitor-jw-player';
const result = await JwPlayer.currentPlaylist();console.log(result);信頼できる情報源
「信頼できる情報源」セクションこのページはプラグインの src/definitions.tsから生成されています。上流で公開 API が変更されたら、sync を再実行してください。
Getting Started から続ける
「Getting Started からの続き」セクション以下を使用している場合: はじめに ダッシュボードと API の操作を計画するには、以下と連携してください @capgo/capacitor-jw-player を使用する @capgo/capacitor-jw-player の使用におけるネイティブ機能については、 API の概要 API Overview の実装の詳細については、 はじめに Introduction の実装の詳細については、 API キー API Keys の実装の詳細については、 デバイス Devices の実装の詳細については。