YouTip LogoYouTip

Av Prop Loop

## HTML Audio/Video DOM loop Property The `loop` property sets or returns whether an audio or video file should start playing over again every time it finishes. --- ## Syntax ### Get the loop state: ```javascript audioOrVideoElement.loop ``` ### Set the loop state: ```javascript audioOrVideoElement.loop = true | false; ``` ### Property Values | Value | Description | | :--- | :--- | | `true` | The audio/video will start over again (loop) when it reaches the end. | | `false` | **Default.** The audio/video will stop playing when it reaches the end. | --- ## Technical Details | Feature | Description | | :--- | :--- | | **Return Value** | A Boolean: `true` if the media loops, `false` otherwise. | | **Default Value** | `false` | | **DOM Level** | HTML5 Media Element | --- ## Code Examples ### Example 1: Setting a Video to Loop Programmatically This example demonstrates how to select a video element and configure it to loop continuously using JavaScript. ```html Video Loop Example

Click the button to enable looping for the video.

``` ### Example 2: Checking the Current Loop Status You can also read the `loop` property to check whether looping is currently enabled or disabled. ```javascript var myVid = document.getElementById("myVideo"); if (myVid.loop === true) { console.log("The video is set to loop."); } else { console.log("The video will play only once."); } ``` --- ## Browser Support The `loop` property is widely supported across all modern browsers: * Google Chrome * Mozilla Firefox * Microsoft Edge / Internet Explorer 9+ * Safari * Opera *Note: Internet Explorer 8 and earlier versions do not support the HTML5 `
← Av Prop MediagroupAv Prop Error β†’