question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

session.close stuck on DRM content

See original GitHub issue

Have you read the FAQ and checked for duplicate open issues?

Yes, this is related to https://github.com/google/shaka-player/issues/1093 but this has been locked as too old.

What version of Shaka Player are you using?

Tried with both 2.5.12 and 3.0.1

Can you reproduce the issue with our latest release version?

Yes

Can you reproduce the issue with the latest code from master?

Not tested

Are you using the demo app or your own custom app?

Custom App

If custom app, can you reproduce the issue using our demo app?

Not tested

What browser and OS are you using?

Chrome 84.0.4147.89, MacOS 10.15.6

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

Shouldn’t be needed a specific manifest, but it must be a DASH with DRM.

What did you do?

  • (see discussion below)

What did you expect to happen?

  • (see discussion below)

What actually happened?


So, here’s what we were trying to do. To get the correct license for a DRM content, we need three parameters. We obtain two of them through the HTTP Request that returns us also the main manifest URL. The third one is the token for authenticating on the service that serves us everything about the media (parameters data included). Theoretically, we might incur into an expired token. For this reason we want to throw error and unload the content.

Here’s our code:

return this.player.load(src, startTime, mimeType)
	.then(() => {
		console.log('READY - The video has now been loaded!');
		this.changePlaybackState('READY');
	})
	.catch(this.handleShakaError_);
handleShakaError_(err: shaka.util.Error) {
	// ... other code

	console.log('onShakaError');
	console.error(err);

	this.unload_()
		.then(() => {
			console.log('THEN, WHAT?');
			this.props.delegate?.onError(new ShakaError(err));
		})
		.catch((err) => console.log('error in unloading', err));
}
unload_() {
	// more code ...

	return this.player.unload(false)
		.then(() => {
			console.log('Unload shaka: finished');
			this.changePlaybackState('IDLE');
		})
		.catch((err) => {
			console.error('Error in unload', err);
			return err;
		});
}

We are receiving in handleShakaError_ this error if we pass in the license URL an expired or invalid token: Shaka Error DRM.LICENSE_REQUEST_FAILED. So we expect then that both Unload shaka: finished or Error in unload AND THEN, WHAT? to be printed in the console, but it never happen.

Instead we see only, in debug mode, Shaka’s logs:

Starting unload...
Closing session 027B2E46533F4895A5055741BFF24CAE

So we started digging down to the root of the problem and we found this:

What happens is that the flow into Shaka halts when this.drmEngine_.destroy(); is executed. In particular, it gets halted on await this.closeOpenSessions_();.

We found that this issue seems linked to issue #1093. It was “solved” by saying that it was a problem with Chrome on MacOS, which wasn’t solving the session.close() for any reason when working with DRM content. A workaround has been introduced in - I don’t know which version it was available on Dec 2017 - this commit: https://github.com/google/shaka-player/commit/734797b8c0a2c68876683c8f544dc1625bd49584: a Promise.race with a timeout. Over time, this workaround has been moved to shaka.media.DrmEngine.closeSession_, but at a certain point, on 1 November 2019, this method has been removed and the fix with it - check here: https://github.com/google/shaka-player/commit/6e252e7b81c49850653a87ba3482bb4cf68961d4#diff-052c6be0b439274b171a21b6729378b1L248

According to the commit message, the Chrome issue seems to be solved, but actually I don’t think it so. Also the topic of Chromebug (https://crbug.com/690583) that was linked in the original issue on GH, is not available anymore (I get “Permission Denied”).

Thank you.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
theodabcommented, Jul 22, 2020

I currently have the previous workaround (and a regression test) in code review. In the meantime, I don’t know how much you can do. Destroying the media element mid-unload is bound to cause weird effects. If I had to guess, I’d say that it’s unblocking the close session process… and then get to the next step of unloading, where we try to unset the media keys on the (now-destroyed) video element.

1reaction
joeyparrishcommented, May 24, 2022

https://bugs.chromium.org/p/chromium/issues/detail?id=1108158 is still open and I’m still hoping to get the Chrome CDM team to do something about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

session.close stuck on DRM content · Issue #2741 - GitHub
The old bug that was filed, was for the case where you removed the session, didn't handle the license-release message, and then tried...
Read more >
DRM-protection troubleshooting - Kanopy Help
Verify that your browser is configured to play DRM content. In Chrome: Go to chrome://settings/content/protectedContent. Ensure Sites can play ...
Read more >
Optimizing License Key Delivery for Persistent and Non ...
Deploying DRM to scale includes analyzing how and where you can use persistent licensing versus non-persistent licensing.
Read more >
DRM Webservice Call Hangs. Seeing stuck thread in Weblogic
Hi Guys, I have followed the Oracle guide to installing and configuring the DRM Web service, however, when i tried to test the...
Read more >
Content Protection with DRM - Flussonic Manual
Make sure you disable all the protocols that do not support the specified DRM. For example, if an encryption method is supported by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found