castlabs / electron-releases

castLabs Electron for Content Security
https://castlabs.com/resources/downstream/
MIT License
225 stars 42 forks source link

Shaka Player (Offline Widevine) #59

Closed oliexe closed 4 years ago

oliexe commented 4 years ago

Hi,

Sorry for posting this into the issues, but I can't seem to find any support group related to castlabs's custom electron build where I can get the answer as soon as possible.

Is it possible to run Shaka Player to download a Widevine protected MPEG-DASH video and store persistent licenses using this build of Electron on macOS ? I need to find a solution for a simple movie player that will be capable to download a video from our server and be able to play the file completely off-line for the next 10 days (So being online is only necessary to download the video into the browser storage and obtain the persistent license).

So, in a nutshell, I need to replicate the following demo inside the electron app on macOS : https://shaka-player-demo.appspot.com/

Is it possible to run the shaka player demo "out-of-the-box" or it is required to custom develop some components? If so? what components need to be developed? I am aware of downSTREAM project, but I want to use the shaka player's internal ability to download the movie and store the license.

Thank you, and yet again I am sorry for posting a question into the issues? As I am unable to find any comprehend answer to such a question around the internet.

Thank You.

khwaaj commented 4 years ago

Hi Ondrej,

Yes, it is possible to use Shaka Player with Electron for Content Security for persistent licenses. I had only used DOWNstream for it until now, but I just successfully tested the Shaka download demo as well, so it works right out of the box for non-production content. For production content you'd need to update the VMP signature, as you probably have seen if you have read through the README, but that information is somewhat outdated since there is a new solution in the works - see https://github.com/castlabs/electron-releases/issues/58#issuecomment-663002442.

If you want to try out the demo yourself you can get away with a minimal electron application that opens the URL up in a BrowserWindow, using a snippet similar to this:

function createWindow () {
  const win = new BrowserWindow({
    webPreferences: {
      nodeIntegration: false,
      plugins: true
    }
  });
  win.loadURL('https://shaka-player-demo.appspot.com/');
}
app.on('widevine-ready', createWindow)

Just make sure you are using Electron for Content Security and not stock electron, and it should work. I hope that answers your questions!

Best, Emil

oliexe commented 4 years ago

@khwaaj

Thank You Emil. Appreciate the fast response 👍 So I got the shaka player demo ready, running inside the Electron for Content Security.

The demo content works fine, but when I want to download/play our video it returns LICENSE_REQUEST_FAILED (Error 6007) probably a rejection by the widevine server. Is that the VMP signature issue you are mentioning? If so, I will get to requesting a production certificate right away.

Edit.: The movies are hosted on Azure Media Services. I have noticed that even in the demo content when I select i want to try the test video on Azure Media Services It will come up with the same error.

Best regards, Ondrej

khwaaj commented 4 years ago

Yeah, it is likely that your request is rejected by VMP because its is a production asset. I'm not sure, but they could be using production level licensing even for the demo content you are trying to play. The other possibility is that you lack some credentials in your license request. For some additional information about that you can look here: https://shaka-player-demo.appspot.com/docs/api/tutorial-license-server-auth.html

You can try to request your own VMP certificate from Google Widevine, but they may have stopped issuing them already, as I mentioned in the comment I referenced above. Either way, it is usually a fairly long wait before you get one, so it is likely we'll roll out the new VMP signing service before that.

oliexe commented 4 years ago

Are you aware of any links for any demo content that accepts the development build of the app so I can just test out the widevine for peace of mind?

Regarding the signing service, do you have any ETA ? As this is quite a time-sensitive project.

khwaaj commented 4 years ago

Well, there are some demos out there that reference open dev content, such as the Shaka demo above, and you can probably use their content for testing if you look into how the content is accessed. A couple of other examples are:

https://demo.castlabs.com https://bitmovin.com/demos/drm

Sorry, I can't give you an ETA beyond "near future", but I'm confident it will be well before you'd be able to get your own VMP certificate, if you'd get one at all. Perhaps you would be interested in being a pilot user? If so, let me know and I'll reach out to you by e-mail.

oliexe commented 4 years ago

Very interested. Please reach out to me using the e-mail address on my GitHub profile.

In the meantime, I will try to request the VMP certificate.

oliexe commented 4 years ago

Just to elaborate more - Widewine is working fine (so far) on some non-azure demo content (I am assuming they have development licencing on some of the sources). But media streamed from Azure media services (ours and demo content) refuses the licence request with the same error. So maybe the Azure Media Services cant be switched to development licencing mode or something?

"Shaka Error DRM.LICENSE_REQUEST_FAILED (shaka.util.Error { "severity": 2, "category": 1, "code": 1001, "data": [ "https://amssamples.keydelivery.mediaservices.windows.net/Widevine/?KID=1ab45440-532c-4399-94dc-5c5ad9584bac", 400, null, { "content-type": "application/json" }, 2 ], "handled": false, "message": "Shaka Error NETWORK.BAD_HTTP_STATUS (https://amssamples.keydelivery.mediaservices.windows.net/Widevine/?KID=1ab45440-532c-4399-94dc-5c5ad9584bac,400,,[object Object],2)", "stack": "Error: Shaka Error NETWORK.BAD_HTTP_STATUS (https://amssamples.keydelivery.mediaservices.windows.net/Widevine/?KID=1ab45440-532c-4399-94dc-5c5ad9584bac,400,,[object Object],2)\n at new shaka.util.Error (https://shaka-player-demo.appspot.com/lib/util/error.js:97:17)\n at Function.makeResponse (https://shaka-player-demo.appspot.com/lib/net/http_plugin_utils.js:51:13)\n at Function.request_ (https://shaka-player-demo.appspot.com/lib/net/http_fetch_plugin.js:200:38)" })"

khwaaj commented 4 years ago

Yes, it is possible they only support production assets. I've seen this in a few other cases, with other DRM services, but I can't say for sure if it is the case with Azure Media Services as I have no direct experience with them. Can you play the assets using the same player code in Chrome? If you can't, it might be that some custom authentication is required, e.g. some extra HTTP header or something.

oliexe commented 4 years ago

Yes, the same assents can be played (and downloaded for offline playback) directly in google chrome without any issues.

khwaaj commented 4 years ago

Then I would say it is almost certain that the issue is the VMP signature.