使用@capgo/capacitor-video-player
Capacitor插件在原生播放器中播放视频。
安装
bun add @capgo/capacitor-video-player
bunx cap sync
此插件暴露的内容
initPlayer- 初始化一个视频播放器。isPlaying- 检查一个给定 playerId 是否正在播放。play- 从一个给定 playerId 播放当前视频。pause- 暂停当前视频从一个给定 playerId。
示例用途
initPlayer
初始化一个视频播放器。
import { VideoPlayer } from '@capgo/capacitor-video-player';
await VideoPlayer.initPlayer({} as capVideoPlayerOptions);
isPlaying
如果给定的 playerId 正在玩游戏。
import { VideoPlayer } from '@capgo/capacitor-video-player';
await VideoPlayer.isPlaying({} as capVideoPlayerIdOptions);
play
从给定的 playerId 播放当前视频。
import { VideoPlayer } from '@capgo/capacitor-video-player';
await VideoPlayer.play({} as capVideoPlayerIdOptions);
pause
暂停当前视频从给定的 playerId。
import { VideoPlayer } from '@capgo/capacitor-video-player';
await VideoPlayer.pause({} as capVideoPlayerIdOptions);
全参考
- GitHub https://github.com/Cap-go/capacitor-video-player/
- 文档:/docs/plugins/video-player/
继续使用 @capgo/capacitor-video-player
如果您正在使用 使用 @capgo/capacitor-video-player 来规划原生媒体和界面行为,连接它与 @capgo/capacitor-video-player For the implementation details in @capgo/capacitor-video-player, 开始使用 For the implementation details in 开始使用, 使用 @capgo/capacitor-live-activities For the native capabilities in 使用 @capgo/capacitor-live-activities, @capgo/capacitor-live-activities For the implementation details in @capgo/capacitor-live-activities, and 使用 @capgo/capacitor-native-navigation For the native capabilities in 使用 @capgo/capacitor-native-navigation.