Closed oliviermartin08 closed 1 year ago
@oliviermartin08
I made some research and I did not find a way to distinguish that a seek happened when the player is playing (rate = 1.0) with the KVO methods used in the NRVideoTracker to send seek events during playback.
I made the exact same research a few years ago when I first created the tracker, and my conclusion is that there is no way to do it, it's a limitation of the AVPlayer KVO system, but is hard to say because Apple didn't document it very well. So yes, your solution (manual signaling) seems like the only possible.
@asllop sounds good!
However, we might still look a bit deeper into this, cause we also noticed that when the user makes a seek during pause, the CONTENT_SEEK_END
event is only sent once the playback is resumed (when the user hits play during pause state). This behavior corrupts the value of the timeSinceSeekBegin
timer in the seek_end event. Also, if multiple seeks are done during pause, only the last one before unpause will be sent.
📖 Description & Context
On iOS, no events were sent to NewRelic when seeking occurred during playback. (see 🎉 Results below). The only seek events received were happening when playback was paused (rate = 0.0).
I made some research and I did not find a way to distinguish that a seek happened when the player is playing (rate = 1.0) with the KVO methods used in the
NRVideoTracker
to send seek events during playback.That being said, if there is a way to know that a seek happened even during playback using the KVO observer methods, please let me know.
👷 Fix
Otherwise, I propose adding a state (
isSeekingDuringPlayback
) that we can manually set when we record a seek during playback from the user on our side. Then, it makes it possible to:CONTENT_SEEK_START
andCONTENT_SEEK_END
.CONTENT_BUFFER_START
andCONTENT_BUFFER_END
with theirbufferType = seek
rather thanconnection
.🎉 Results
The actions performed on the player before and after this fix are:
Before
After