removeEventListener

Description

Remove an event listener. That is, remove a callback previously registered with addEventListener from being triggered on the corresponding event. This also free-up the corresponding ressources.

The callback given is optional: if not given, every registered callback to that event will be removed.

Syntax

// Remove all callbacks linked to event
player.removeEventListener(event);

// Remove specific listener
player.removeEventListener(event, callback);
  • arguments:

    1. event string: The event name.

    2. callback (optional) Function|undefined: The callback given when calling the corresponding addEventListener API.

Example

player.removeEventListener("playerStateChange", listenerCallback);
Page List