Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix HLS and DASH caption issues #4

Merged
merged 5 commits into from
Jul 8, 2024
Merged

fix HLS and DASH caption issues #4

merged 5 commits into from
Jul 8, 2024

Conversation

anarchivist
Copy link
Member

@anarchivist anarchivist commented Jun 27, 2024

  • upgrades mediaelement.js
    • hopefully a surgical change. downstream packages (hls.js and dash.js) are already drawn from the latest by default in mediaelement.js. based on past WIP by @jason-raitz.
  • change player initialization to fix DASH double captions:
    • switches from class-based "automatic start" of MediaElement.js instantiation to jQuery-based instantiation. this is necessary as we need to pass dash.js configuration options in to prevent it from rendering captions for us.
    • add crossorigin="anonymous" to <video> tag to allow a browser to load the webvtt file from wowza.lib.b.e.; otherwise this would be a cross-domain request
    • remove default from <track> tag to prevent captions from showing automatically.
  • handle WebVTT captions in HLS manifests
    • inject HLS.js configuration options to hide captions it renders (guards against a similar issue as we saw with dash.js)
    • note: this will require wowza configuration changes (setting cupertinoVODCaptionsUseWebVTT to true for all collections).
    • add new helper methods to grab the URI for a WebVTT file included in a HLS manifest. adds a dependency on m3u8 (removed in 07263a6)

fixes DP-796; supersedes #3

hopefully a surgical change. downstream packages (hls.js and dash.js)
are already drawn from the latest by default in mediaelement.js. based
on past WIP by @jason-raitz. refs [DP-796](https://ucblib.atlassian.net/browse/DP-796).

Co-authored-by: María A. Matienzo <[email protected]>
Co-authored-by: Jason Raitz <[email protected]>
@anarchivist anarchivist force-pushed the upgrade-mejs branch 2 times, most recently from 17751dd to 77032d7 Compare July 2, 2024 17:54
@anarchivist anarchivist changed the title [wip] update mediaelement.js to latest release fix HLS and DASH caption issues Jul 3, 2024
@jason-raitz
Copy link
Contributor

This looks great!

@anarchivist anarchivist marked this pull request as ready for review July 3, 2024 20:48
* switches from class-based "automatic start" of MediaElement.js
instantiation to jQuery-based instantiation. this is necessary
as we need to pass dash.js configuration options in to prevent
it from rendering captions for us.
* add `crossorigin="anonymous"` to `<video>` tag to allow a
browser to load the webvtt file from wowza.lib.b.e.; otherwise
this would be a cross-domain request
* remove `default` from `<track>` tag to prevent captions from
showing automatically.
* add new helper methods to grab the URI for a WebVTT file included in a HLS manifest
* insert new <track/> tags specifically for HLS streams
* inject HLS.js configuration options to hide captions it renders

this will require setting the cupertinoVODCaptionsUseWebVTT property in all
wowza collections to true.

squashed refactors:

* refactor new hls vtt private methods in track extensions
* remove track tag for iOS as it is unnecessary
for iOS, it'll autodiscover the captions in the HLS stream when the viewer
is in its standard full-screen mode. the track extensions code that grabs
the HLS stream's WebVTT is thus unnecessary. this commits separates it out
in case it becomes useful in the future.
@anarchivist
Copy link
Member Author

did some more refactoring. the additional <track/> tag is not necessary for iOS and thus we can remove some dead code.

@anarchivist anarchivist merged commit 231dcb9 into main Jul 8, 2024
8 checks passed
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.

2 participants