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

Filter out repeated seek and volume change events happening when user holds down the player controls (close #1218) #1219

Merged

Conversation

matus-tomlein
Copy link
Contributor

Issue #1218

This PR adds the ability to filter out repeated seek and volume change events in the media plugin that occur frequently when the user is scrubbing the controls in players (e.g., in the Vimeo or HTML5 players).

The algorithm to filter out the events is very simple – if a seek event is tracked, it is kept in a buffer (not tracked) until an event other than a seek event is tracked or until the media tracking ends (endMediaTracking is called).

So if the following events are tracked:

  • play
  • seek start 1
  • seek end 2
  • seek start 2
  • seek end 2
  • pause

By filtering events, the result will be:

  • play
  • seek start 1
  • seek end 2
  • pause

Filtering out repeated seek and volume change events is enabled by default, but it is possible to disable as follows:

startMediaTracking({ id, filterOutRepeatedEvents: false });

or like this:

startMediaTracking({ id, filterOutRepeatedEvents: { seekEvents: false });

@bundlemon
Copy link

bundlemon bot commented Jun 30, 2023

BundleMon

Files added (6)
Status Path Size Limits
libraries/browser-tracker-core/dist/index.mod
ule.js
+25.07KB 26KB / +10%
trackers/javascript-tracker/dist/sp.js
+24.03KB 25KB / +10%
trackers/javascript-tracker/dist/sp.lite.js
+14.7KB 15KB / +10%
trackers/browser-tracker/dist/index.umd.min.j
s
+14.55KB 15KB / +10%
libraries/tracker-core/dist/index.module.js
+13.35KB 15KB / +10%
trackers/browser-tracker/dist/index.module.js
+3.46KB 5KB / +10%

Total files change +95.15KB 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history

Copy link
Contributor

@greg-el greg-el left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Tested it with the Vimeo plugin and it's working nicely!

@matus-tomlein matus-tomlein force-pushed the issue/1218-filter_out_repeated_media_events branch from 834b278 to 1f055db Compare August 7, 2023 13:37
@matus-tomlein matus-tomlein changed the base branch from master to release/3.14.0 August 7, 2023 13:52
@matus-tomlein matus-tomlein merged commit fc2a210 into release/3.14.0 Aug 7, 2023
3 checks passed
@matus-tomlein matus-tomlein deleted the issue/1218-filter_out_repeated_media_events branch August 7, 2023 16:06
greg-el pushed a commit that referenced this pull request Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants