Getting Started
Ce contenu n'est pas encore disponible dans votre langue.
Install
Section titled “Install”bun add @capgo/capacitor-mux-playerbunx cap syncImport
Section titled “Import”import { MuxPlayer } from '@capgo/capacitor-mux-player';API Overview
Section titled “API Overview”Launch the native Mux Player in fullscreen and begin playback.
import { MuxPlayer } from '@capgo/capacitor-mux-player';
await MuxPlayer.play({} as MuxPlayOptions);dismiss
Section titled “dismiss”Dismiss the player if it is visible.
import { MuxPlayer } from '@capgo/capacitor-mux-player';
await MuxPlayer.dismiss();isActive
Section titled “isActive”Returns whether the player is currently being displayed.
import { MuxPlayer } from '@capgo/capacitor-mux-player';
await MuxPlayer.isActive();Type Reference
Section titled “Type Reference”MuxPlayOptions
Section titled “MuxPlayOptions”export interface MuxPlayOptions { /** * The playback ID of the asset you want to stream. */ playbackId: string; /** * Provide a JSON web token generated for signed playback policies. */ playbackToken?: string; /** * Provide a JSON web token generated for DRM playback policies. */ drmToken?: string; /** * Override the default Mux playback domain (e.g. `stream.example.com`). */ customDomain?: string; /** * Auto-play when the player becomes visible. Defaults to true. */ autoPlay?: boolean; /** * Start playback from the provided time (in seconds). */ startTime?: number; /** * Provide a poster image URL to display before playback begins. */ poster?: string; /** * Provide a custom title to surface in native player chrome when available. */ title?: string; /** * Provide a subtitle or description to surface in native player chrome when available. */ subtitle?: string; /** * Set to true to keep the video muted when playback starts. */ muted?: boolean; /** * Mux Data environment key used for analytics. If omitted, the SDK default is used. */ environmentKey?: string; /** * Provide an explicit player name for analytics. Defaults to a generated name. */ playerName?: string; /** * Enable smart caching when the underlying SDK supports it. */ enableSmartCache?: boolean; /** * Enable verbose logging in native SDKs where available. */ debug?: boolean;}MuxPlayerEvents
Section titled “MuxPlayerEvents”export interface MuxPlayerEvents { /** * Fired when the underlying player is ready to begin playback. */ ready: { playerName?: string }; /** * Fired when playback starts or resumes. */ play: void; /** * Fired when playback pauses. */ pause: void; /** * Fired when playback ends. */ ended: void; /** * Fired when an unrecoverable error occurs. */ error: { message: string }; /** * Fired when the fullscreen player is closed. */ playerDismissed: void;
/** * Get the native Capacitor plugin version * * @returns {Promise<{ id: string }>} an Promise with version for this device * @throws An error if the something went wrong */ getPluginVersion(): Promise<{ version: string }>;}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.