You might clarify this comment to note that there are two different things going on here. 

1) If we get an ended event while a drag is in progress, then we want to ignore it.  (That is the if (dragging) part)

2) If we get an ended event as the result of the user explicitly trying to seek to the end of the video we don't want to skip to the start.  And this is the part that relies on us calling pause when the user purposely seeks to the end.