fix(html5): exit early on emulated tracks in html5 #3772

Merged
merged 2 commits into from Nov 11, 2016

3 participants

@gkatsev
Video.js member

addRemoteTextTrack and removeRemoteTextTrack in Html5 tech assumed that
they are always called for native text tracks. However, Html5 tech can
have emulated text tracks. For those, we just exit early after the super
methods are called.

@gkatsev gkatsev fix(html5): exit early on emulated tracks in html5
addRemoteTextTrack and removeRemoteTextTrack in Html5 tech assumed that
they are always called for native text tracks. However, Html5 tech can
have emulated text tracks. For those, we just exit early after the super
methods are called.
573204e
@misteroneill

Verified as working in the real world.

@boushley

This works and so is great!

I think I would actually prefer using the non-negated if here for both cases. It cleans up the add track case significantly, and the remove track case isn't so big that the extra indentation causes lots of problems. The reason for this is that it makes the return path consistent. For remove this isn't a big deal, but for add it's nice to have a single return since it makes it easier to verify that both cases return the same data.

That said, this is a pretty minor thing for such small methods, so I'm fine as is.

@gkatsev gkatsev update ifs
bead49f
@boushley

I like it!

And if you turn on ignore whitespace it looks nice and clean: https://github.com/videojs/video.js/pull/3772/files?w=1

@gkatsev gkatsev merged commit 252bcee into videojs:master Nov 11, 2016

2 checks passed

Details continuous-integration/travis-ci/pr The Travis CI build passed
Details coverage/coveralls Coverage decreased (-0.8%) to 84.296%
@gkatsev gkatsev deleted the gkatsev:text-tracks branch Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment