Conversation
94bdeeb to
e706e4c
Compare
brandonhrowe
previously approved these changes
Jul 11, 2025
Contributor
brandonhrowe
left a comment
There was a problem hiding this comment.
A couple of tiny nits, but otherwise I like this approach!
| if (iframes[i].contentWindow !== event.source) { | ||
| continue; | ||
| } | ||
| const senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null; |
Contributor
There was a problem hiding this comment.
Suggested change
| const senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null; | |
| const senderIFrame = findIframeBySourceWindow(event.source, parent); |
Nit. findIframeBySourceWindow already returns null if event.source is falsy.
| return; | ||
| } | ||
|
|
||
| const currentAllow = senderIFrame.getAttribute('allow') || ''; |
Contributor
There was a problem hiding this comment.
Suggested change
| const currentAllow = senderIFrame.getAttribute('allow') || ''; | |
| const currentAllow = senderIFrame.allow; |
Nit. allow lets you retrieve this a little easier.
| * @param {Document} [doc=document] The document to search within | ||
| * @return {HTMLIFrameElement|null} The iframe element if found, otherwise null | ||
| */ | ||
| export function findIframeBySourceWindow(sourceWindow, doc = document) { |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1095 +/- ##
==========================================
+ Coverage 72.01% 73.76% +1.74%
==========================================
Files 7 7
Lines 604 625 +21
==========================================
+ Hits 435 461 +26
+ Misses 169 164 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
brandonhrowe
approved these changes
Jul 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This pull request provides a workaround for failed playback in the case of DRM embeds that are missing the required
encrypted-mediain theirallowattribute.Why
In order to play a video that uses Encrypted Media Extensions inside an iframe, browsers require that
encrypted-mediais included in theallowattribute on the iframe. For Vimeo customers that enable DRM on existing embedded videos and are unable to update all of their videos to add the required attribute, the changes in this pull request will ensure their videos continue to playback (with DRM) by adding the attribute to embed once we've detected it's "required".How
The changes in this pull request will apply the iframe updates when the SDK receives a "drminitfailed" failed event from an embed and we've determined it's missing the
encrypted-mediaallowattribute. Once the attribute has been updated, the SDK will reload the iframe to ensure that playback will occur successfully.In addition to the changes for DRM playback, this pull request does some minor refactoring to add a utility method for finding the iframe that sent a message, and using that utility method in the various places where iframe location is needed.