You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When this happens, the _toggleLevel method throws an error because this[i] is undefined. Looking into it a bit, it seems like removing any quality level other than the last one shifts the index of all other levels. So after removing quality level 0, the former "quality level 1" will become the new "quality level 0", the former "quality level 2" will become the new "quality level 1", etc - and "quality level X" (the last one in the list) will be "undefined"
However the _toggleLevel method is bound with a particular quality level's ID. This means that the wrong quality level is accessed after one has been removed
It should be possible to work around this by scanning the list for the appropriate level each time. For instance:
For various reasons someone may wish to remove quality levels in a VideoJS plugin:
540p-main
and540p-baseline
Currently the following code will lead to errors:
When this happens, the
_toggleLevel
method throws an error becausethis[i]
is undefined. Looking into it a bit, it seems like removing any quality level other than the last one shifts the index of all other levels. So after removing quality level 0, the former "quality level 1" will become the new "quality level 0", the former "quality level 2" will become the new "quality level 1", etc - and "quality level X" (the last one in the list) will be "undefined"However the
_toggleLevel
method is bound with a particular quality level's ID. This means that the wrong quality level is accessed after one has been removedIt should be possible to work around this by scanning the list for the appropriate level each time. For instance:
The text was updated successfully, but these errors were encountered: