Skip to content

Pause/Play button repaints causes flaky control in Chrome when using a Youtube video #694

Closed

Description

@redactieuvw

Describe the bug
When using a Youtube video a interval is set here. This causes the refreshControls method to run periodically, which in turn ignores the context parameter and thus refreshes all UI elements, including the pause/play button. The getIcon method removes the element and repaints it, which causes flaky control in Chrome (141.0.7390.108). In Ableplayer v4.6.0 this problem didn't exist, because this works with changing the class instead of deleting and rebuilding the svg (at least, that is what I suspect).

Version tested
Which version of AblePlayer are you reporting against?

  • Main (the current release)
    v4.7.0

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://ableplayer-poc.vercel.app/ using Chrome (only tested on MacOS 26.0 (25A354))
  2. Repeatedly press the play/pause button

Expected behavior
I expect the button to, more or less, instantly correspond to the Youtube player state and when pressing the button it always works (which is not the case currently)

Desktop (please complete the following information):

  • OS: MacOS 26.0 (25A354)
  • Browser Chrome (141.0.7390.108)

Smartphone (please complete the following information):
Not tested on smartphone

Additional context
I've quick fixed the problem by adding a button state (thisObj.activePlayPauseButtonState) to the refreshControls method:

if (currentState === 'paused' || currentState === 'stopped' || currentState === 'ended') {
	if(thisObj.activePlayPauseButtonState !== 'play') {
		thisObj.$playpauseButton.attr('aria-label',thisObj.tt.play);
		thisObj.getIcon( thisObj.$playpauseButton, 'play' );
		thisObj.$playpauseButton.find('span.able-clipped').text(thisObj.tt.play);
		thisObj.activePlayPauseButtonState = 'play';
	}
} else if(thisObj.activePlayPauseButtonState !== 'pause') {
	thisObj.$playpauseButton.attr('aria-label',thisObj.tt.pause);
	thisObj.getIcon( thisObj.$playpauseButton, 'pause' );
	thisObj.$playpauseButton.find('span.able-clipped').text(thisObj.tt.pause);
	thisObj.activePlayPauseButtonState = 'pause';
}

Now a repaint will only happen when the last state was it's opposite. But I can imagine there are better ways to fix this (maybe using the Youtube player API?)

Thanks!

Activity

  1. joedolson commented on Oct 24, 2025

    @joedolson
    Member

    The YouTube player API is...iffy. So that might help, but I'll experiment. Thanks for the bug report!

  2. added theissue type on Oct 24, 2025
  3. added this to the 4.8 milestone on Oct 24, 2025
  4. drumwhacker commented on Dec 5, 2025

    @drumwhacker

    Thank for looking into this, we also ran into this play button issue with youtube in one of our projects specifically using 4.7.

  5. joedolson commented on Dec 27, 2025

    @joedolson
    Member

    I've got a different solution for this, which I think is better, as it will impact all icons. I've modified getIcon so it checks whether the icon already exists and skips the repaint if it does.

  6. added a commit that references this issue on Dec 27, 2025
    4f11091
  7. joedolson commented on Dec 27, 2025

    @joedolson
    Member

    I'm closing this issue, as I believe it's resolved; if anybody does come in and find an issue with this solution, don't hesitate to let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions