-
Notifications
You must be signed in to change notification settings - Fork 425
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: extend stats object #10
Conversation
Do we want this as a plugin on the player? or should it be apart of the |
src/videojs-http-streaming.js
Outdated
currentSource: player.currentSource(), | ||
master: player.tech_.hls.masterPlaylistController_.masterPlaylistLoader_.master, | ||
currentTech: player.tech_.name_, | ||
// TODO: filter by VHS logging only |
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.
How do we want to go about this? Currently videojs doesn't do any type of filtering or bucketing of the history, just a single array that all logging args get dumped into.
Some options I can think of:
- prefix all log messages we add with a VHS specific string so we can filter on that
- send only objects into the logs e.g.
{ vhs: true, message: 'log message' }
Downside to this is if the debug log is enabled, videojs will console log objects for all of our messages instead of just the message - extend videojs.log to seperate history by type or allow a way of requesting logs in history of a specific type. Downside to this would be not being available on previous versions of videojs
Perhaps this should be on |
Then again we have not yet exposed |
src/videojs-http-streaming.js
Outdated
currentTime: player.currentTime(), | ||
timestamp: Date.now(), | ||
currentSource: player.currentSource(), | ||
master: player.tech_.hls.masterPlaylistController_.masterPlaylistLoader_.master, |
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.
could use the shortcut player.tech_.hls.playlists.master
src/videojs-http-streaming.js
Outdated
return { | ||
videoPlaybackQuality: player.getVideoPlaybackQuality(), | ||
playerDimensions: player.currentDimensions(), | ||
hlsStats: player.tech_.hls.stats, |
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.
do we want to call this hlsStats
since the stats apply to dash sources as well?
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 should probably be renamed vhsStats
since it would be the vhs.stats
object
src/util/logger.js
Outdated
return videojs.log.debug.bind(videojs, '[VHS]', `${source} >`); | ||
} | ||
|
||
return function() {}; |
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.
Do we want to fall back to videojs.log
when videojs.log.debug
does not exist?
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 would then print out the logging by default
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 ya we don't want that
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.
Would be good to have tests for logger and getPlaybackStats
@@ -672,27 +671,17 @@ export default class SegmentLoader extends videojs.EventTarget { | |||
return null; | |||
} | |||
|
|||
this.logger_('checkBuffer_', |
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.
Any specific reason for removing this and other logs that currently exist?
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.
@mjneil was removing some excessive logging
src/videojs-http-streaming.js
Outdated
return { | ||
videoPlaybackQuality: this.tech_.getVideoPlaybackQuality(), | ||
playerDimensions: this.tech_.currentDimensions(), | ||
vhsStats: this.stats, |
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 seems a bit ambiguous in naming considering we have vhsStats
as a sub property of playbackStats
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.
Do we want to merge with stats
or perhaps just extend stats
?
@@ -0,0 +1,11 @@ | |||
import videojs from 'video.js'; | |||
|
|||
const logger = (source) => { |
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 will not allow us the ability to turn debug logging on mid session via videojs.log.level('debug')
. If we want to support that, we will need something like this
const logger = (source) => (...args) => {
if (videojs.log.level() === 'debug') {
videojs.log.debug('VHS:', `${source} >`, ...args);
}
};
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.
you don't even need the .call(videojs,
in your way @mjneil.
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.
oh right, good call!
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.
oops this is checking if debug api is available, not if the mode is debug
import videojs from 'video.js'; | ||
|
||
const logger = (source) => { | ||
if (videojs.log.debug) { |
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 know we discussed how the history object might get crowded by the debug logging once it's available. Do we know about how many logs per minute of video we'll be generating?
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.
Looks like around ~35 items per minute with what's being logged at the moment
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.
If that's pretty standard (and we can't get into a case where the log messages explode), that seems pretty good (to not have to hide behind another config flag). We should be careful to look at some of the cases in case any could spew messages though, and test some scenarios to make sure we don't kill a browser tab from memory consumptions.
src/videojs-http-streaming.js
Outdated
@@ -377,6 +377,20 @@ class HlsHandler extends Component { | |||
} | |||
}); | |||
|
|||
const getTimeRanges = (player, type) => { |
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 player and type are only used once to get the time ranges, it might be simpler and clearer to only pass in the time ranges themselves. The function may also be better served as being called timeRangesToArray
and if we put it outside of the function we can add some tests for it.
ChromeCanary Support
Description
This adds a few more properties to the
hls.stats
object as well as uses the newdebug
logging level.TODO
Requirements Checklist