-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: stats for timeToLoadedData, appendsToLoadedData, mainAppendsToLoadedData, audioAppendsToLoadedData, and mediaAppends #1106
Changes from 1 commit
dae964e
1de5821
ef33818
4b2ecd0
ce4bf99
d75374e
7540d10
51c7b10
4d9c882
25b4889
d4b22dc
9cd6e0f
eb017aa
c48c3bb
1f7852b
70155e7
6cd2015
44cda65
36dfe49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -622,6 +622,7 @@ export default class SegmentLoader extends videojs.EventTarget { | |
this.mediaRequestsErrored = 0; | ||
this.mediaTransferDuration = 0; | ||
this.mediaSecondsLoaded = 0; | ||
this.mediaAppends = 0; | ||
} | ||
|
||
/** | ||
|
@@ -2988,6 +2989,8 @@ export default class SegmentLoader extends videojs.EventTarget { | |
// used for testing | ||
this.trigger('appended'); | ||
|
||
this.mediaAppends++; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will show extra appends for:
It will also under-report total number of appends, since we potentially append multiple times per segment. Do we want to consider those cases and think about naming as "segmentAppends" since that may denote full segments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sync requests that do not get appended will return much earlier in the function. We could wrap There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the other problem with calling it segment appends is that we now append parts too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 on sync requests On wrapping and part appends, what is our use-case for this data? Do we want to know actual appends, or are we more concerned about requests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we want to know actual appends, we already have stats for requests. |
||
|
||
if (!this.paused()) { | ||
this.monitorBuffer_(); | ||
} | ||
|
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.
once we 'canplay' a frame will be showing.
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.
Apparently this is close to a "time to first byte" since if we are paused, the video may not get rendered immediately.
playing
or firsttimeupdate
is potentially closer to a time to first rendered frame if we are autoplaying/not paused.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.
There's this experimental API that can better represent the frame getting rendered https://wicg.github.io/video-rvfc/
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.
switched it to
loadeddata
https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/loadeddata_eventas it specifically says: "The loadeddata event is fired when the frame at the current playback position of the media has finished loading; often the first frame."
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.
that seems more like time to first byte rather than time to first frame, the latter implies that the frame has rendered which loadeddata doesn't guarantee it.
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.
Looked even deeper and tested on a few browsers, It seems like listening to
loadeddata
might be as close as we are going to get. Forpreload === 'none'
we will have to start our timer onplay
but for all other values we should be able to start it onloadstart
. Using those values gives somewhat consistenttimeToFirstFrame
for me.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 guess what do you consider
timeToFirstFrame
? Is it the data has been loaded into the video element or the frame has rendered visibly to the user?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.
Since we don't have a good way to determine if the frame has been rendered visibly to the user (except for the experimental API), I think time to first frame should be when the video element reports that it has a
buffered
region containingcurrentTime
. That might be a few ms before the frame is visible to the user, but I think it's the best cross browser solution.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.
Makes sense. I would probably want to rename the field then. We should also make sure to document exactly what it means so that we don't get confused in the future and have a place to reference it.
Also, does live have anything special for this beyond being equivalent to preload=none?
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.
maybe
timeToLoadedData
andappendsToLoadedData
? Live shouldn't be any different for VOD for these stats.