Bug 1891599 - Create PiP JWPlayer Wrapper r=kpatenio
ClosedPublic

Authored by joe.scott.webster on Apr 17 2024, 6:50 PM.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.

@kpatenio @niklas

I resolved this issue by creating a new nbcnews.js wrapper instead of creating an AOL wrapper.

The JWPlayer embedded on AOL websites operates within an iframe. Consequently, the only way to access JWPlayer captions is by retrieving the 'src' property passed from the iframe (in this case: https://www.nbcnews.com). Note: This iframe issue was identified by Katherine in the previous Yahoo bug - Bug 1890807

This approach now displays Picture-in-Picture (PiP) captions for NBC News videos embedded within AOL websites (e.g. https://www.aol.com/o-j-simpson-former-nfl-145545988.html). Additionally, it has the added benefit of displaying PiP captions for all videos on the main NBC News website.

In the end, AOL videos played using the Video.js player will use the videoJSWrapper and NBC News videos played using the JWPlayer will use the nbcnews wrapper (whether embedded or not).

AOL Captions (JWPlayer playing NBC News video)

AOL PiP - JW Player with Captions.png (975×1 px, 913 KB)

NBC News Captions

NBC News - PiP with Captions.png (1×3 px, 1 MB)

niklas requested changes to this revision.Apr 17 2024, 7:36 PM

Because the JW player isn't specific to NBC we should rename the nbcnews.js file to jwplayer.js or something similar

This revision now requires changes to proceed.Apr 17 2024, 7:36 PM

Thanks for the patch @joe.scott.webster, great work! I agree with @niklas that we should rename the wrapper, for it seems that the script is specific to JW Player rather than nbcnews. That way, there won't be any confusion about why a "nbcnews" wrapper would work with another site like AOL. This is actually exciting news because that means we can add support for more sites using the same video player! 😄 I happen to have a list of other sites using JW Player that I'd love to see added in, but we can do that as follow-up work and file another ticket for it.

Some additional remarks:

  1. Could you please rename your patch, since we're no longer adding an AOL specific wrapper?
  2. ^ I also suggest renaming the Bugzilla ticket
  3. I left some inline comments about the wrapper

AOL Captions (JWPlayer playing NBC News video)

AOL PiP - JW Player with Captions.png (975×1 px, 913 KB)

NBC News Captions

NBC News - PiP with Captions.png (1×3 px, 1 MB)

Just FYI, we don't see the attached screenshots on Phabricator. You might have to change the visibility settings for each image in Referenced Files on the right side.

browser/extensions/pictureinpicture/data/picture_in_picture_overrides.js
159

suggestion: I also suggest renaming this key in the overrides to jwplayer or similar.

The property "https://*.nbcnews.com/*" already implies that this wrapper is compatible for all videos loaded within that site.

browser/extensions/pictureinpicture/video-wrappers/nbcnews.js
14 ↗(On Diff #850409)
issue: If you disable captions on the original nbc news video while the PiP window is open, PiP captions will be stuck. We should ensure that they're hidden when disabled on the original video.

As a workaround, you might have to modify which element is our container and which is our text in setCaptionContainerObserver, especially if container ends up getting removed from the DOM whenever captions are disabled

Thank you for the comments and feedback! I plan to make these changes tomorrow.

joe.scott.webster retitled this revision from Bug 1891599 - Create AOL site-specific wrapper. r=kpatenio to Bug 1891599 - Create PiP JWPlayer Wrapper r=kpatenio.Apr 19 2024, 2:13 PM
joe.scott.webster updated this revision to Diff 851556.
joe.scott.webster marked an inline comment as done.
niklas requested changes to this revision.Apr 19 2024, 5:57 PM

This looks good. I just have a minor nit

browser/extensions/pictureinpicture/data/picture_in_picture_overrides.js
159

I'm ok with this being nbcnews because we do it like this for all of the videoJS wrappers

browser/extensions/pictureinpicture/video-wrappers/jwplayerWrapper.js
27

nitpick: minor nit

This revision now requires changes to proceed.Apr 19 2024, 5:57 PM
joe.scott.webster updated this revision to Diff 851574.

I just changed nbcnews to jwplayer. I'd be happy to change it back if that's what you decide.

joe.scott.webster added a subscriber: scunnane.

@kpatenio @niklas I've incorporated your changes. Thank you for you're feedback. If everything looks good I'll ask @scunnane to land the patch.

Katherine, you have some additional bugs/features I can work on, correct?

This looks good to me! Thanks for working on this!

testing-exception-other: We don't have a way to test site specific wrappers

My pleasure. Are there any additional PiP related bugs/features I can help with?

This revision was not accepted when it landed; it landed in state Needs Review.Apr 23 2024, 6:21 PM
This revision was automatically updated to reflect the committed changes.

My pleasure. Are there any additional PiP related bugs/features I can help with?

Hey @joe.scott.webster, sorry the delay from my end! I just filed a new ticket https://bugzilla.mozilla.org/show_bug.cgi?id=1893061 for adding more sites under the jwplayer wrapper that you just made. Would you be interested in picking that up?