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

Reduce forced reflows in Seekbar #653

Merged
merged 6 commits into from
Nov 19, 2024
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed
- Potential performance impact caused by forced layout reflows

## [3.74.0] - 2024-10-24

### Changed
Expand Down
11 changes: 9 additions & 2 deletions src/ts/components/seekbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,17 @@ export class SeekBar extends Component<SeekBarConfig> {

uimanager.onControlsShow.subscribe(() => {
this.isUiShown = true;
if (!player.isLive() && !this.smoothPlaybackPositionUpdater.isActive()) {
playbackPositionHandler(null, true);
this.smoothPlaybackPositionUpdater.start();
}
});

uimanager.onControlsHide.subscribe(() => {
this.isUiShown = false;
if (this.smoothPlaybackPositionUpdater.isActive()) {
this.smoothPlaybackPositionUpdater.clear();
}
});

let isPlaying = false;
Expand Down Expand Up @@ -323,12 +330,12 @@ export class SeekBar extends Component<SeekBarConfig> {
scrubbing = false;
};

let onPlayerSeeked = (event: PlayerEventBase = null, forceUpdate: boolean = false ) => {
let onPlayerSeeked = (event: PlayerEventBase = null) => {
isPlayerSeeking = false;
this.setSeeking(false);

// update playback position when a seek has finished
playbackPositionHandler(event, forceUpdate);
playbackPositionHandler(event, true);
};

let restorePlayingState = function () {
Expand Down
Loading