Skip to content

Add Widevine DRM support for web platforms#168

Open
Micoder-dev wants to merge 1 commit intokdroidFilter:masterfrom
Micoder-dev:master
Open

Add Widevine DRM support for web platforms#168
Micoder-dev wants to merge 1 commit intokdroidFilter:masterfrom
Micoder-dev:master

Conversation

@Micoder-dev
Copy link

Summary

Adds Widevine DRM support for web platforms (WASM/JS) using dash.js for DASH manifest parsing and EME for license acquisition.

Features

  • DrmConfiguration data class for DRM settings (type, license URL, headers)
  • DrmHelper JavaScript module bridging Kotlin/WASM with browser EME APIs
  • dash.js integration for DASH/MPD playback with DRM protection
  • DRM controls in sample app with test stream support
  • HTTPS dev server config (required for EME)

Supported

  • Widevine on Chrome/Firefox/Edge (web)

Coming Soon

  • PlayReady, ClearKey
  • Android (ExoPlayer DRM), iOS (FairPlay)

Documentation

See WEB_DRM_SUPPORT.md for installation and usage.

Test

  1. Run: ./gradlew :sample:composeApp:wasmJsBrowserDevelopmentRun
  2. Open https://localhost:8080
  3. Enable DRM toggle → Load Test Stream → Open URL

Features:
- DrmConfiguration data class for DRM settings
- DrmHelper JavaScript module for EME integration
- dash.js integration for DASH/MPD playback
- DRM controls in sample app with test stream
- HTTPS dev server config (required for EME)

Supported: Widevine on Chrome/Firefox/Edge
Coming soon: PlayReady, ClearKey

See WEB_DRM_SUPPORT.md for usage documentation
@kdroidFilter
Copy link
Owner

Thank you very much for your work. At first glance, it looks really good. I haven’t had time to properly review the code yet, but I’ll probably do that this weekend.

That said, I can already say that as long as support is not universal, the DRM configuration should not be exposed in the common code. Also, I haven’t checked the size of the JS libraries being used yet, but I think it would be cleaner to create a dedicated DRM module (like Media3 does), so that apps that don’t need it aren’t unnecessarily bloated. This is even more critical on the web.

@Micoder-dev
Copy link
Author

Thank you very much for your work. At first glance, it looks really good. I haven’t had time to properly review the code yet, but I’ll probably do that this weekend.

That said, I can already say that as long as support is not universal, the DRM configuration should not be exposed in the common code. Also, I haven’t checked the size of the JS libraries being used yet, but I think it would be cleaner to create a dedicated DRM module (like Media3 does), so that apps that don’t need it aren’t unnecessarily bloated. This is even more critical on the web.

Thanks — that makes sense. I can refactor the DRM parts into a separate optional module and move the configuration out of commonMain. I’ll work on it when I’m free and push an update once I restructure it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants