Play audio & video

Play remote audio and video through the device's native player.

Play audio

Examples reuse the single browser client from Set up the client. Adjust the ~/lib/bdk import to your app’s path; do not create a client in each component or handler.

Play a remote audio track in the native player.

import { bdk } from "~/lib/bdk";

await bdk.media.playAudio({ url: "https://example.com/tracks/song.mp3" });

Pause and stop audio

Pause the current track or stop playback entirely.

await bdk.media.pauseAudio();
await bdk.media.stopAudio();

Play a video

Play a remote video in the native player. Pass muted: true to start playback muted.

await bdk.media.playVideo({ url: "https://example.com/clips/demo.mp4" });

Play a video playlist

Play a sequence of videos back to back. Pass muted: true to start playback muted.

iOS only — wrap the call in try/catch.

await bdk.media.playVideoPlaylist({
  videos: [
    "https://example.com/clips/one.mp4",
    "https://example.com/clips/two.mp4"
  ],
  muted: true
});

See it running in the live demo, or every native feature with its demo on thebdk.com.