Skip to content

Conversation

@domlander
Copy link
Contributor

@domlander domlander commented Oct 6, 2025

What does this change?

This PR allows a subtitle (VTT) file to be passed into the looping video player.

Why?

For now, DCR will not implement a third-party library to support HLS on all browsers. Instead, DCR will leverage built in browser support.

This means that

  • For browsers with native HLS support (e.g. Safari), the player uses an .m3u8 stream.
  • For browsers without native HLS support (e.g. Chrome), the player falls back to an .mp4 file with a sidecar .vtt subtitle file.

Chrome and other browsers enforce stricter cross-origin rules for subtitle files. To ensure subtitles load correctly, the looping video player now uses an anonymous CORS policy for all video and subtitle requests. As a consequence, local development of loops must now be done on r.thegulocal.com, as localhost requests will be blocked by CORS.

With built in browser subtitles, we are limited to how much we can style the cue boxes. The client runs javascript to adjust the line of each cue box so that it sits 12px above the bottom of the video player. As cuebox lines are measured in %, this is achieved by measuring the height of the video before calculating the percentage from bottom. This could be enhanced further by using a resizer function to adjust the calculation when the window is resized but this has not been included in this PR as self styled subs will display most often.

Further styling enhancements will be introduced in a follow up PR. This is because each browser currently applies its own styling and so it subtitle appearance is not consistent across the board.

Screenshots

Chrome Safari Firefox
before after fire

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

@abeddow91 abeddow91 force-pushed the doml/subtitles branch 2 times, most recently from a4b507b to d6e2c9a Compare October 20, 2025 09:05
@abeddow91 abeddow91 marked this pull request as ready for review October 20, 2025 14:34
@abeddow91 abeddow91 added fronts + curation feature Departmental tracking: work on a new feature labels Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dotcom-rendering feature Departmental tracking: work on a new feature fronts + curation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants