Skip to content

fix(web): forward contentprotectionerror events to React Native layer#857

Closed
tvanlaerhoven wants to merge 4 commits into
developfrom
devin/1782478638-forward-contentprotectionerror
Closed

fix(web): forward contentprotectionerror events to React Native layer#857
tvanlaerhoven wants to merge 4 commits into
developfrom
devin/1782478638-forward-contentprotectionerror

Conversation

@tvanlaerhoven

@tvanlaerhoven tvanlaerhoven commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

The web THEOplayer SDK fires contentprotectionerror as a separate event from error. WebEventForwarder only listened for 'error', so DRM/content protection errors were silently dropped on web.

On native (Android/iOS), content protection errors already arrive as regular PlayerEventType.ERROR events (with ErrorCode.CONTENT_PROTECTION_ERROR). This fix makes web consistent by forwarding contentprotectionerror as PlayerEventType.ERROR:

// WebEventForwarder.ts — addEventListeners()
  this._player.addEventListener('error', this.onError);
+ this._player.addEventListener('contentprotectionerror', this.onContentProtectionError);

// New handler — maps ContentProtectionErrorEvent → DefaultErrorEvent
+ private readonly onContentProtectionError = (event: NativeContentProtectionErrorEvent) => {
+   this._facade.dispatchEvent(
+     new DefaultErrorEvent({
+       errorCode: event.errorObject.code.toString(),
+       errorMessage: event.errorObject.message,
+     }),
+   );
+ };

Link to Devin session: https://dolby.devinenterprise.com/sessions/4f3f8d74c30b45dfb651a76c65693a83
Requested by: @tvanlaerhoven


Open in Devin Review

The web THEOplayer SDK fires contentprotectionerror as a separate event
from the regular error event. The WebEventForwarder was only listening
for 'error' events, causing DRM/content protection errors to be silently
dropped on the web platform.

On native (Android/iOS), content protection errors already come through
as regular ERROR events with content-protection-specific error codes.

Forward the web SDK's contentprotectionerror as a PlayerEventType.ERROR
to make behavior consistent across all platforms.

Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
@tvanlaerhoven tvanlaerhoven self-assigned this Jun 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
@tvanlaerhoven

Copy link
Copy Markdown
Member Author

Suggest a CHANGELOG entry that I can simply confirm & commit if OK.

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Here's a suggested CHANGELOG entry under ## [Unreleased]:

### Fixed

- Fixed an issue on Web where `contentprotectionerror` events from the THEOplayer SDK were not forwarded to the React Native layer, causing DRM-related errors to be silently dropped.

@tvanlaerhoven

Copy link
Copy Markdown
Member Author

More concise:

- Fixed an issue on Web where `contentprotectionerror` events were not dispatched.

Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

Added to CHANGELOG with your wording in f18d962.

Co-Authored-By: tom.vanlaerhoven <tom.vanlaerhoven@dolby.com>
@tvanlaerhoven

Copy link
Copy Markdown
Member Author

contentprotectionerror needs to be forwarded as a separate event

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.

1 participant