开始使用
复制一个包含安装步骤和本插件的完整 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.
安装
标题:安装您可以使用我们的 AI 助手设置来安装插件。使用以下命令将 Capgo 技能添加到您的 AI 工具中:
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.如果您prefer手动设置,请运行以下命令并遵循以下平台特定的说明:
bun add @capgo/capacitor-jw-playerbunx cap sync导入
标题:导入import { JwPlayer } from '@capgo/capacitor-jw-player';API概述
标题:API概述initialize
标题:初始化初始化 JW Player
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.initialize({} as { licenseKey: string; playerUrl?: string });play
标题:播放播放视频
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.play({} as { mediaUrl: string; mediaType: 'video' | 'playlist'; autostart?: boolean });pause
暂停暂停当前播放的媒体
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.pause();resume
恢复恢复暂停的媒体
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.resume();stop
停止停止当前播放的媒体
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.stop();seekTo
跳转到跳转到当前播放的媒体的特定位置
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.seekTo({} as { time: number });setVolume
Section titled “setVolume”设置音量
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setVolume({} as { volume: number });getPosition
Section titled “getPosition”获取当前媒体位置
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getPosition();getState
Section titled “getState”获取当前播放器状态
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getState();setSpeed
Section titled “setSpeed”设置播放速度
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setSpeed({} as { speed: number });setPlaylistIndex
Section titled “setPlaylistIndex”Set the current item in the playlist by index
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setPlaylistIndex({} as { index: number });loadPlaylist
Section titled “loadPlaylist”Load a playlist
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylist({} as { playlistUrl: string });loadPlaylistWithItems
Section titled “loadPlaylistWithItems”Load a playlist with items
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.loadPlaylistWithItems({} as { playlist: any[] });getAudioTracks
Section titled “getAudioTracks”Get available audio tracks
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getAudioTracks();getCurrentAudioTrack
getCurrentAudioTrack的部分获取当前音频轨道
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getCurrentAudioTrack();setCurrentAudioTrack
setCurrentAudioTrack的部分设置当前音频轨道
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentAudioTrack({} as { index: number });getCaptions
getCaptions的部分获取可用的字幕/字幕
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getCaptions();getCurrentCaptions
getCurrentCaptions的部分获取当前字幕/字幕轨道
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.getCurrentCaptions();setCurrentCaptions
setCurrentCaptions标题设置当前字幕/字幕轨
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.setCurrentCaptions({} as { index: number });currentPlaylist
currentPlaylist标题获取当前播放列表
import { JwPlayer } from '@capgo/capacitor-jw-player';
await JwPlayer.currentPlaylist();真实数据来源
Source Of Truth标题此页面由插件生成 src/definitions.ts重新同步公共API时,重新运行上游
如果您正在使用 开始使用 为了计划仪表板和API操作,连接它 使用@capgo/capacitor-jw-player 使用@capgo/capacitor-jw-player的本机功能 API概述 API的实现细节 介绍 __CAPGO_KEEP_0__的实现细节 API密钥 API的实现细节 设备 设备详细信息的实现细节。