Play Widevine & Clearkey DRM Streams In Your Web Browser
This is for educational purposes only - Do not play streams you do not have to right to play. You need to provide any decrypt keys or license URLs for this to work. This application does not extract/generate or provide any such keys
If you just want to test locally load drm_player.html straight into Firefox web browser (it will not work in Chrome)
But if you want to host the html file and play in any web browser including Chrome, you will need to use the proxy server. I've included a host server and proxy server as examples
Open drm_player.html in your web browser
Technically if you wanted to watch it on your tv you could if you had a web browser on the tv that supports widevine/clearkey although see the limitation above. It maybe better running the server version
Enter mpd url
Enter license url or decryption key
Clone this repo git clone https://github.com/purplescorpion1/Widevine-DRM-Browser-Player
Requires python eg Windows install from https://www.python.org/downloads/windows/
Requires the following python modules to be installed
pip install flask requests mitmproxy
Download and install OpenSSL Binaries
Windows https://slproweb.com/products/Win32OpenSSL.html
Linux/Mac sudo apt install openssl
/ brew install openssl
Create SSL keys
In Widevine-DRM-Browser-Player directory open cmd/terminal window replacing IP at the end of the command with the IP the flask server will be running on
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=IP"
Open Widevine-DRM-Browser-Player/static/drm_proxy_player.html
in a coding text editor eg notpad++
Change the IPs in the following sections to the IP address of the machine running the script
await fetch('https://192.168.1.123:5098/set_proxy_config', {
const proxyMpdUrl = `https://192.168.1.123:5098/proxy?url=${encodeURIComponent(mpdUrl)}`;
Open Widevine-DRM-Browser-Player/drm_player_server.py
in a coding text editor eg notpad++
Change the IP in the following line to the IP address of the machine running the script
app.run(host='192.168.1.123', port=5098, debug=True, ssl_context=('cert.pem', 'key.pem'))
Open Widevine-DRM-Browser-Player/drm_player_mitmproxy.py
in a coding text editor eg notpad++
Change the IP in the following line to the IP address of the machine running the script
if flow.request.url.startswith("http://192.168.1.123:8080/"):
flow.request.url = flow.request.url.replace("http://192.168.1.123:8080/", "")
python if on windows 11
python3 if on linux
Run the following commands in separate cmd/terminal windows replacing the IP address in the mitmproxy command with the IP of the machine running the script
python drm_player_server.py
mitmdump -s drm_player_mitmproxy.py -p 8080 --listen-host 192.168.1.123
Now in your web browser go to changing the IP address to the IP address of the machine running the server. Important to enter the https:// at the start!
https://192.168.1.123
Note you will get a warning about unsafe/unsigned site due to your self signed SSL. To avoid this you will need a SSL certificate from a recognised provider. Just tell your browser you want to proceed to the site
Enter mpd url
Enter license url or decryption key
Enter the referer
Enter the origin
To play the stream press play once all stream details have been entered
If you have a current streamurls.json load it first (see How To Load Stream Details)
To save the stream url and keys to load later press save
It will ask you to enter a name for the stream
It will then download streamurls.json containing stream urls and keys
If streamurls.json already exists it will amend it to eg streamurls(1).json
Delete old file and rename new one streamurls.json
Press Browse then select your streamurls.json
Select a saved stream from the drop down window
You can temporarily remove a stream from the list by selecting the delete stream button
To permanently remove you need to delete it from the streamurls.json file