Skip to content

Player#error() throws after the player is disposed #9213

Description

@philippd

Description

Calling player.error() after disposal throws because Player#error() calls addClass('vjs-error') after the player element has been cleared.

Reduced test case

https://codepen.io/philippde/pen/RNKMmNL

Steps to reproduce

<!doctype html>
<video id="player" class="video-js"></video>

<script type="module">
  import videojs from 'video.js';

  const player = videojs('player');

  player.dispose();
  player.error(3);
</script>

Errors

TypeError: Cannot read properties of null (reading 'classList')
    at addClass
    at Player.addClass
    at Player.error

What version of Video.js are you using?

8.23.9

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

Firefox 152.0.5

What OS(es) and version(s) does this occur with?

Mac OS 26.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: triageThis issue needs to be reviewed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions