[BUG] H5P Interactive Video: Default Text Track Fails to Load Correctly

Issue:
In H5P Interactive Video, the default text track fails to load the correct caption file, even though the caption list correctly displays the intended default caption.

Expected Behavior:
When a default caption is set, H5P should load and display the corresponding text track file.

Actual Behavior:
Despite the default caption being correctly set and displayed in the caption list, H5P incorrectly loads the English (or the first) text track file instead.

Steps to Reproduce:

  1. Set a specific caption (e.g., Thailand) as the default in the H5P Interactive Video settings.
  2. Play the video and check the loaded text track.
  3. Observe that H5P loads the English text track file instead of the intended default.

I initially discovered this error in the Moodle H5P content activity and reported it to the Moodle team (you can find the bug tracking link below).

Link: https://tracker.moodle.org/browse/MDL-84687

However, Moodle closed the report as 'Not a bug,' as the issue stems from H5P itself. Therefore, I am now reporting it directly to H5P.

 

Content types: 
otacke's picture

This is in fact a bug in Interactive Video (https://github.com/h5p/h5p-interactive-video/blob/6f0d20ea680935612aa278189316c1550c319f3b/src/scripts/interactive-video.js#L624-L641).

I have created a ticket.

The "SelectorControl" is instantiated (line 624), sets the default track visually in the selector and then triggers a `select` event intended for the main class to pick up and change the track for good. The listener to pick up that event, however, is not in place at that time (added in line 639-641). So, depending on the timing, this may work - or not.

This could easily be fixed, but in order to prevent touching things twice, the intended behavior overall should be made clear first, as there's a contradiction:

  1. The description in semantics.json (line 141) suggests that if no default track is specified, the first text track will be used as the default.
  2. The code of the main class (line 619), however, suggests to set the default to "off" when no default track is specified.

What's the real intended behavior? HFP-2534 leads me to believe that it is #1, but Svein-Tore mentions in a comment that '"The first text track will be used as the default." is problematic if you want the default to be no text track.' In fact, forcing a text track onto users is what I as a user hate.

Wouldn't this make more sense? (keeping the change small and not adding a "track picker").

As an author, I want to be able to select the default behavior for text tracks to either be "none", "automatic" or "custom" with a specific label.

  1. "none": No text track will be active by default.
  2. "automatic": Determine the language that the browser is set to (`Navigator.language`) and match it with the available tracks' BCP 47 "source language" value that can be set in the editor. If there's a match, use the respective track by default. If there's no match, fall back to "none".
  3. "custom": Try to match the label that the author set with the available labels of the tracks. If there's a match, use the respective track by default. If there's no match, fall back to "none".

 

 

BV52's picture

Thanks Oliver! 

otacke's picture

Svein-Tore has already answered, pull request will be ready later today. 

otacke's picture

The pull request with the fix is ready. Please take a look at https://h5ptechnology.atlassian.net/browse/HFP-4221 to check progress. It's now in H5P Groups hands.