Skip to content

Events

The player will emit various events, which you can listen to using the player.on and player.once methods. You can also trigger custom or predefined events using player.emit, with event names in CamelCase format.

You can import the EVENT object from qier-player to access these event names.

ts
import Player, { EVENT } from 'qier-player'

const player = new Player(...)
console.log(EVENT.CONTROLLER_SHOW)
console.log('ControlShow') // Equivalent string

const noop = () => {}

player.on(EVENT.CONTROLLER_SHOW, noop)
player.once(EVENT.CONTROLLER_SHOW, noop)
player.off(EVENT.CONTROLLER_SHOW, noop)
player.emit(EVENT.CONTROLLER_SHOW)

Event List

Event NameDescriptionEnum Value
PlayPlay videoEVENT.PLAY
PausePause videoEVENT.PAUSE
EndedVideo has endedEVENT.ENDED
TimeUpdateCurrent time updatedEVENT.TIME_UPDATE
ProgressDownloaded video range updatedEVENT.PROGRESS
DurationChangeTotal video duration changedEVENT.DURATION_CHANGE
VolumeChangeVolume level changedEVENT.VOLUME_CHANGE
WaitingVideo is in waiting stateEVENT.WAITING
StalledVideo is loadingEVENT.STALLED
CanPlayVideo can be playedEVENT.CANPLAY
LoadedMetadataVideo source data loadedEVENT.LOADED_METADATA
RateChangePlayback rate changedEVENT.RATE_CHANGE
ErrorAn error occurredEVENT.ERROR
SeekedVideo has been seekedEVENT.SEEKED
ControlShowController displayedEVENT.CONTROLLER_SHOW
ControlHideController hiddenEVENT.CONTROLLER_HIDE
UpdateSizePlayer size updatedEVENT.UPDATE_SIZE
WebEnterFullscreenEntered web fullscreenEVENT.WEB_ENTER_FULLSCREEN
WebExitFullscreenExited web fullscreenEVENT.WEB_EXIT_FULLSCREEN
EnterFullscreenEntered fullscreenEVENT.ENTER_FULLSCREEN
ExitFullscreenExited fullscreenEVENT.EXIT_FULLSCREEN
EnterPipEntered Picture-in-Picture modeEVENT.ENTER_PIP
ExitPipExited Picture-in-Picture modeEVENT.EXIT_PIP
MountedPlayer has been mountedEVENT.MOUNTED
AfterInitInitialization completeEVENT.AFTER_INIT
BeforeDisposeBefore player is destroyedEVENT.BEFORE_DISPOSE
AfterDisposeAfter player is destroyedEVENT.AFTER_DISPOSE
PopoverShowChangePopover display state changedEVENT.POPOVER_SHOW_CHANGE
ControllerElesUpdateController elements updatedEVENT.CONTROLLER_ELES_UPDATE
LoadingShowLoading indicator displayedEVENT.LOADING_SHOW
LoadingHideLoading indicator hiddenEVENT.LOADING_HIDE

Released under the MIT License.