Skip to main content

Web SDK installation and setup

MeshStream Web SDK adds P2P acceleration to HLS and DASH playback without replacing the existing player. MP4 and MP3 acceleration is enabled only when Service Worker is available. The player keeps manifest parsing, ABR, decoding, and rendering; the SDK owns playback sessions and acceleration handling.

Before you start​

  • An SDK Key created in the console.
  • A playable HLS .m3u8, DASH .mpd, or an MP4/MP3 URL with Range support.
  • A <video> or <audio> element in the page.

Install the SDK:

npm install @meshstream/p2p-web

Browser and player integration choices​

Choose the transport path from browser capability, then choose the integration API from player ownership. getCapability() can power an integration hint; whether P2P is actually enabled still depends on the runtime and service policy.

EnvironmentHLS / DASH integrationP2P pathNotes
Chromium browsers, including Chrome and EdgeUse attach for a new page; see attachToHls, Shaka, and dash.js adapters in Advanced Usage for existing playersMSE + WebRTC preferredRecommended Web P2P environment.
FirefoxUse attach or the relevant player adapterEnabled when both MSE and WebRTC are availableUse the runtime capability result.
macOS SafariUse attach and rely on runtime capability detection; DASH depends on the host playerStandard MSE + WebRTC when MSE is available; Service Worker can also be forced for controlled rolloutDo not make a static decision by browser name; check getCapability() first.
iPhone/iPad SafariNative <video> for HLS with a same-origin Service WorkerNative player + Service Worker P2PiOS/iPadOS Safari has no MSE HLS P2P path. P2P is enabled after the Worker activates and controls the page; otherwise playback falls back to CDN.
Direct MP4 / MP3 playbackDeploy the same-origin Worker script; Advanced Usage can explicitly configure its path and scopeSame-origin Service Worker + Range P2P onlyThe SDK attempts Worker registration by default. If the Worker is inactive, HTTPS is unavailable, or the origin lacks Range support, playback continues through CDN.

Existing players do not need to migrate: use attachToHls for hls.js, attachToShaka for Shaka, attachToDashJs for dash.js, attachToVhs for Video.js VHS, and attachToRxPlayer for RxPlayer. Initialization order and capability boundaries are in Advanced Usage.

Next step​

After completing the setup above, continue to Quick integration to create a session, connect your player, and release playback resources.