Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in here we still want to do
|| 0
because if what is passed in, isn't a number we should just assume 0.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem with leaving the
|| 0
is that ifplayer.techGet_('duration')
equalsNaN
when handleTechDurationChange_() is first called, then the initial value ofplayer.cache_.duration
is 0 rather thanNaN
. At least that was the case with the page I was testing with.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. 🤔
I guess maybe this is fine since
parseFloat()
will returnNaN
for bad values. So, we'd just want to make sure the rest of this method handlesNaN
correctly, if it doesn't already.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looks like this is fine but I think the duration display's
updateDuration
method needs to be updated to account forNaN
values. Specifically, what happens if we start with unknown duration, transitioning from unknown duration to a known duration, and transitioning from a known duration to an unknown duration. That last one in particular I think might be problematic, though, not sure how common it is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conditional will be
false
ifplayer.duration() = NaN
, so off the top of my head I can't think of a problem going from a unknown duration to a known duration. If we are transitioning from a known duration to an unknown duration, I believe the duration display (as currently written) would keep its previous 'known' state until the new duration becomes known and the display updates. Assuming I'm right about that, would this be acceptable behavior?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's probably fine. Just wanted someone to think about it in some more depth.