2

I tried to play Netflix videos on a simple electron browser. The browser I used is present as a simple quick start for electron at https://github.com/electron/electron-quick-start.
I just loaded URL https://www.netflix.com instead of index.html in this.

But netflix failed with error code: M7701-1003

I have already tried the steps listed at https://www.electronjs.org/docs/latest/tutorial/testing-widevine-cdm and they did not work.
Can someone tell what more needs to be done in this?

Update: I followed the steps mentioned in the "Verifying Widevine CDM support Section" of documentation, for the first link it says "Your browser lacks features to play this video" and the second link does not exist.

  • Please follow the steps described under "Verifying Widevine CDM support" in the Electron documentation you have linked and [edit] your question to contain your findings. NB: The docs state that you'll probably have to obtain a license from Widevine and sign your Electron app, so I don't think that it's going to be that easy to get it to work... – Alexander Leithner Nov 16 '21 at 07:54
  • @AlexanderLeithner I have updated the question, regarding license I am not sure. – Aseem Saxena Nov 16 '21 at 09:46
  • 2
    Well, then I presume that the Electron documentation is right (assuming that you have loaded the Widevine CDM plugin correctly) and you'll need to acquire a license from Widevine for your application. – Alexander Leithner Nov 16 '21 at 18:59

1 Answers1

0

Widevine is a pain. I used the Castlabs Electron fork for ECS located here.

  • Most services will NOT work when you play actual content if you just run the code
  • You must build a package signed by Widevine for it to work properly

I used the Castlabs EVS for this located here.

  • You must add a call in the build process to EVS via the electron-builder afterPack or afterSign hook
  • You must sign prior to code signing on Mac and after code signing on Windows

Something like this for mac (named afterPack.js and referenced in afterPack in your package.json build key):

exports.default = function (context) {
  // Skip if not mac
  if (process.platform !== 'darwin') return

  // VMP sign via EVS
  const { execSync } = require('child_process')
  console.log('VMP signing start')
  execSync('python3 -m castlabs_evs.vmp sign-pkg ./dist/mac ' + context.appOutDir)
  console.log('VMP signing complete')
}

NOTE: You must sign up for an EVS account (free) and you will need to have Python to use it.

In your main.js instantiate your window when Widevine is ready (read guide for the appropriate setup):

// Widevine DRM setup
app.commandLine.appendSwitch('no-verify-widevine-cdm')
const isOffline = false
const widevineDir = app.getPath('userData')

// Widevine DRM ready
app.on('widevine-ready', () => {
  createWindow()
})

On the browser support part of this, be sure to set a valid user agent e.g. (mac):

[BrowserWindow or BrowserView].webContents.loadURL('https://urltostream', { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36' })

I have a working app located here.

midnight-coding
  • 2,857
  • 2
  • 17
  • 27
jtvberg
  • 228
  • 3
  • 8