Skip to content
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

Added bufferingConfig to include scrub events while computing buffering metrics #10

Merged
merged 1 commit into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@
player.eventTracking({
performance: function(data) {
log('tracking:performance', data);
}
},
/*
// optional configuration to consider buffering while user is scrubbing on the video player.
bufferingConfig: {
includeScrub: true
}*/
});

player.on('tracking:firstplay', function(e, data) {
Expand Down
7 changes: 6 additions & 1 deletion src/tracking/buffering.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* @param {Object} [options={}]
* An object of options left to the plugin author to define.
*
* Can contain the following optional configuration, passed during plugin initialization:
* bufferingConfig.includeScrub => Boolean indicating whether buffering metrics
* should be considered for computation while user is scrubbing on the video player.
*
*
* Tracks when the video player is marked as buffering and waits until the player
* has made some progress.
*
Expand Down Expand Up @@ -40,7 +45,7 @@ const BufferTracking = function(config) {
const onPause = () => {
bufferStart = false;

if (this.scrubbing()) {
if (this.scrubbing() && !(config.bufferingConfig && config.bufferingConfig.includeScrub)) {
scrubbing = true;
timer = setTimeout(function() {
scrubbing = false;
Expand Down