Best practices
MeshStream does not replace the application player or CDN. A production integration should follow four principles: create an independent session for every playback; always use the playback URL returned by the SDK; release the session when content or lifecycle ends; and validate normal playback when acceleration is unavailable.
Shared across platforms
Use a stable content identifier
Pass a stable contentId for the same media asset. Do not use a complete signed URL as the identity: signatures change and prevent useful peer aggregation.
Keep one session per playback
Create a session for each player instance. Dispose or close it when playback ends, the source changes, or the player is released.
Keep the CDN path healthy
P2P is an enhancement. Keep the origin, CDN, authorization, and player path working. Before each production rollout, confirm that a session appears in the console, that the player uses playbackUrl, and that playback completes after P2P or acceleration traffic is disabled.
Use short media segments for faster peer availability
Choose HLS/DASH segment duration together with the player buffer policy, live-latency target, and CDN configuration. A starting point of about 1--2 seconds is often appropriate; longer segments delay sharing, while very short segments can increase request and scheduling overhead. The Web SDK can configure the initial wait for DASH VOD; live playback should prioritize timely startup. Set httpDownloadInitialTimeoutMs: 0 to disable the initial VOD wait explicitly.
Roll out gradually
Start with one application, region, platform, or version. Watch peer availability, fallback reasons, startup time, and error rates before expanding.
Web
- Use HTTPS and allow the required WebSocket/WebRTC traffic.
- Attach the SDK to the player lifecycle rather than creating a global session.
- Avoid exposing keys or origin credentials in public code or query strings.
Android
- Keep the SDK session aligned with the Media3/ExoPlayer instance.
- Handle background, foreground, and player release explicitly.
- Let the player own ABR and buffering; use SDK events for delivery diagnostics.
iOS
- Create and close a session with the AVPlayer lifecycle.
- Do not send origin authorization headers to peers.
- Treat background transitions and network changes as normal fallback conditions.
Windows
- Keep the native session alive for the lifetime of the player.
- Marshal SDK callbacks onto the thread that owns your player UI.
- Validate DLL loading, firewall rules, and CDN fallback on clean machines.
Before launch
- Test normal P2P delivery.
- Disable P2P and confirm full CDN playback.
- Test expired authorization, network changes, and zero-peer conditions.
- Verify usage and diagnostics for each target region.