Handle correctly seek events while paused #21
Merged
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.
📖 Description & Context
On iOS, a fix has been recently done to the video tracker in order to improve the seek events. What was done in #20:
CONTENT_SEEK_START
andCONTENT_SEEK_END
events.CONTENT_BUFFER_START
andCONTENT_BUFFER_END
with theirbufferType = seek
rather thanconnection
when seek occurs.CONTENT_SEEK_END
event was only sent once the playback was resumed. That behavior was corrupting thetimeSinceSeekBegin
timer.CONTENT_BUFFER_START
andCONTENT_BUFFER_END
events were simply not sent, while it's still not possible to directly resume playback for a certain buffer time.👷 Fix
Modified the state
isSeekingDuringPlayback
forisUserSeeking
. With this solution, the lib integrators are now 100% handling when a seek event starts (on a user seek interaction). Then, with the KVO observers, the tracker is handling by itself when the seek ends as well as its buffer. So, right now:CONTENT_SEEK_START
andCONTENT_SEEK_END
events are sent when paused (without the need to restart the playback).CONTENT_BUFFER_START
andCONTENT_BUFFER_END
events are sent when the player stays in a pause state. TheCONTENT_BUFFER_END
is sent when it's possible for the user to resume playback without any loading time (which is when the observerplaybackLikelyToKeepUp
changes totrue
during the pause state while seeking).📓 Notes about this solution
CONTENT_SEEK_END
was not handled by the tracker on par with the buffer events, it was leading to certain race conditions and unwanted behaviors.SEND_SEEK_START
,SEND_SEEK_END
and its buffer start/end.