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: trigger change events on remoteTextTrack when nativeTextTrack is set to true #6410

Merged
merged 4 commits into from
Mar 12, 2020

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Jan 15, 2020

It seems we have never triggered change events on remoteTextTrack when we were using native text tracks. This was a problem for VHS, which exclusively uses text tracks.
This makes it so we do trigger the event. Main issue with this change is that it creates a potential for a false positive where a change event was triggered from a non-remote text track but the remoteTextTrack list still received a change event. This issue is mitigated by best practices of looping through the list looking for the modes that you care about.

@@ -273,13 +273,26 @@ class Html5 extends Tech {
return;
}
const listeners = {
change(e) {
techTracks.trigger({
change: (e) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this was changed to an arrow function so that line 294 can be used as is without requiring to get the remoteText getter in the higher scope as we only need it in one usecase.

Copy link
Contributor

@gesinger gesinger left a comment

Choose a reason for hiding this comment

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

Would be worth adding a test.


techTracks.trigger(event);

// if we are a text track change event, we should also notify the
Copy link
Contributor

Choose a reason for hiding this comment

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

May be worth adding a note about the alternative approach in case there's ever time to implement it, if it's still seen as a benefit.

Copy link
Member Author

Choose a reason for hiding this comment

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

The comment is really long. Maybe I'll short it to with a link here and elaborate a bit more here.

@gkatsev
Copy link
Member Author

gkatsev commented Jan 15, 2020

Makes sense to add a test.

@mbetz08
Copy link

mbetz08 commented Jan 29, 2020

Friendly ping- what's the status of this PR? Is it awaiting the addition of tests?

@third774
Copy link
Contributor

A test has been added for this!

… native text tracks (#6434)

Co-authored-by: Kyle Boutette <kyleveB@gmail.com>
@third774
Copy link
Contributor

Looks like the tests are failing now in CI (firefox & IE)

@gkatsev
Copy link
Member Author

gkatsev commented Feb 19, 2020

Looks like firefox doesn't like the way that we're loading the track. I even changed it to explicitly set the mode to showing on addtrack and we're still failing in firefox.

@gkatsev
Copy link
Member Author

gkatsev commented Feb 19, 2020

Firefox is refusing to add the track to the player in the test.

@gkatsev
Copy link
Member Author

gkatsev commented Feb 19, 2020

running the same code outside of the test works but fails in the test 🤔

@gkatsev
Copy link
Member Author

gkatsev commented Feb 19, 2020

It seems like everything should be working with changes I have locally but for whatever reason even though the video element has the track element added to it, it seems like things aren't linked properly when in the test.

@gkatsev
Copy link
Member Author

gkatsev commented Feb 19, 2020

I got the test passing once and got excited so when to simply what I had written and now can't get it working again.

@gkatsev
Copy link
Member Author

gkatsev commented Feb 21, 2020

@third774 if you have some time to take a look at why firefox isn't working, that would be appreciated, but I don't think it should be a blocker anymore. If you do figure it out after this has been merged, we can always have a separate PR.

@third774
Copy link
Contributor

@gkatsev if you say so! Thanks for all the help! I'll poke at it a bit and let you know if I make any progress.

@gkatsev
Copy link
Member Author

gkatsev commented Mar 11, 2020

videojs/http-streaming#759 depends on this PR, though, they can be merged separately.

@gkatsev gkatsev merged commit 52c181d into master Mar 12, 2020
@gkatsev gkatsev deleted the native-remote-text-tracks branch March 12, 2020 15:26
gkatsev added a commit to videojs/http-streaming that referenced this pull request Mar 16, 2020
When native text tracks are used, the cues added need to be native cues. It works on conjuction with videojs/video.js#6410.

Co-authored-by: Kevin Kipp <kevin.kipp@gmail.com>
Co-authored-by: Kyle Boutette <kyleveb@gmail.com>
gkatsev added a commit to videojs/http-streaming that referenced this pull request Mar 16, 2020
When native text tracks are used, the cues added need to be native cues. It works on conjuction with videojs/video.js#6410.

Co-authored-by: Kevin Kipp <kevin.kipp@gmail.com>
Co-authored-by: Kyle Boutette <kyleveb@gmail.com>
gkatsev added a commit to videojs/http-streaming that referenced this pull request Mar 16, 2020
When native text tracks are used, the cues added need to be native cues. It works on conjuction with videojs/video.js#6410.

Co-authored-by: Kevin Kipp <kevin.kipp@gmail.com>
Co-authored-by: Kyle Boutette <kyleveb@gmail.com>
gkatsev added a commit to videojs/http-streaming that referenced this pull request Mar 16, 2020
When native text tracks are used, the cues added need to be native cues. It works on conjunction with videojs/video.js#6410.

Co-authored-by: Kevin Kipp <kevin.kipp@gmail.com>
Co-authored-by: Kyle Boutette <kyleveb@gmail.com>
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.

5 participants