YouTip LogoYouTip

Av Event Play

## HTML Audio/Video DOM 'play' Event The `play` event is a standard HTML5 Media Event that fires when an audio or video element is no longer pausedβ€”either because the `play()` method was called, or because the user clicked the play button on the media controls. This event indicates that the media has transitioned from a paused state to an active playback state. --- ## Definition and Usage The `play` event is triggered when the playback of an audio or video file starts or resumes. * **Key Difference:** The `play` event fires as soon as the playback state changes to "playing" (even if the media is still buffering). If you need to detect when the media actually begins to render frames or output sound after buffering, use the `playing` event. * **Related Event:** The `pause` event is triggered when the audio or video is paused by the user or programmatically. --- ## Browser Support The numbers in the table specify the first browser version that fully supports this event: | Event | Chrome | Internet Explorer / Edge | Firefox | Safari | Opera | | :--- | :--- | :--- | :--- | :--- | :--- | | **play** | Yes | 9.0 | Yes | Yes | Yes | --- ## Syntax You can register the `play` event listener in three different ways: ### 1. In HTML ```html ``` ### 2. In JavaScript (using the `onplay` event handler property) ```javascript mediaElement.onplay = function() { // Your custom script }; ``` ### 3. In JavaScript (using `addEventListener()`) ```javascript mediaElement.addEventListener("play", myScript); ``` > **Note:** The `addEventListener()` method is the modern standard and is recommended for most applications. It is supported in Internet Explorer 9 and later. --- ## Technical Details | Property | Description | | :--- | :--- | | **Supported HTML Tags** | `
← Av Event PlayingAv Event Pause β†’