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 for #5292 - push to filterSubtitleTracks output if kind is captions #5297

Merged
merged 2 commits into from Mar 17, 2023

Conversation

dstreet26
Copy link
Contributor

@dstreet26 dstreet26 commented Mar 15, 2023

This PR will...

fix #5292

Are there any points in the code the reviewer needs to double check?

I did not test on Edge, which is part of the comments in filterSubtitleTracks..

So I guess just make sure this is still working on different agents/devices as originally intended?

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
    • Can be added to this PR if needed
  • API or design changes are documented in API.md
    • N/A

@robwalch robwalch added this to the 1.3.5 milestone Mar 16, 2023
Copy link
Collaborator

@robwalch robwalch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onTextTrackChanged and toggleTrackModes depend on filterSubtitleTracks and have test coverage.

describe('toggleTrackModes', function () {

The issue is the tests are setup to add two subtitle tracks and no captions tracks:

    const textTrack1 = videoElement.addTextTrack('subtitles', 'English', 'en');
    const textTrack2 = videoElement.addTextTrack('subtitles', 'Swedish', 'se');

We should include a captions track and update the tests so that there is coverage for this issue and we don't repeat the regression in the future.

@dstreet26
Copy link
Contributor Author

I'm not sure the best way to go about this in this repo so I just wrapped the test...

I added ['subtitles', 'captions'].forEach(function (captionType) { to the top of the test file.

If this is not the right way, I can revert. Like I said, not sure about what to do.

@robwalch
Copy link
Collaborator

I added ['subtitles', 'captions'].forEach(function (captionType) { to the top of the test file.

This does get us coverage. I'm going to merge and create a patch. We can circle back to tests that cover a mix of tracks with different characteristics at a later date.

@robwalch robwalch merged commit 4029b6d into video-dev:master Mar 17, 2023
robwalch pushed a commit that referenced this pull request Mar 17, 2023
robwalch pushed a commit that referenced this pull request Mar 17, 2023
@robwalch
Copy link
Collaborator

@dstreet26 v1.3.5 is up.

After merging and cherry picking I updated the tests to just include an additional captions track and test:

    const textTrack1 = videoElement.addTextTrack('subtitles', 'English', 'en');
    const textTrack2 = videoElement.addTextTrack('subtitles', 'Swedish', 'se');
    const textTrack3 = videoElement.addTextTrack(
      'captions',
      'Untitled CC',
      'en'
    );

    textTrack1.groupId = 'default-text-group';
    textTrack2.groupId = 'default-text-group';
    textTrack3.groupId = 'default-text-group';
    subtitleTrackController.groupId = 'default-text-group';

    textTrack1.mode = 'disabled';
    textTrack2.mode = 'disabled';
    textTrack3.mode = 'disabled';
    it('should set subtitleTrack if captions track is showing', function () {
      expect(subtitleTrackController.subtitleTrack).to.equal(-1);

      videoElement.textTracks[2].mode = 'showing';
      subtitleTrackController.onTextTracksChanged();

      expect(videoElement.textTracks[2].kind).to.equal('captions');
      expect(subtitleTrackController.subtitleTrack).to.equal(2);
    });

We should have another test that covers setting subtitleTrackController.subtitleTrack = 2; for this issue. That was a miss on my part. That seemed to be the core issue with #5292 (enabling tracks of kind "captions" via hls.subtitleTrack = was not doing anything. The filter is meant to ignore tracks of kind "metadata " (so ideally we should add one of those too in these tests).

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.

Regression starting with 1.2.1 -- Captions no longer show up
2 participants