HTML Audio/Video DOM mediaGroup Attribute

Example

Set media group for two videos:

myVid1=document.getElementById("video1");
myVid2=document.getElementById("video2");
myVid1.mediaGroup="test";
myVid2.mediaGroup="test";

Try It Yourself

Definition and Usage

The mediaGroup attribute sets or returns the name of the media group to which the audio/video belongs.

Media groups allow two or more audio/video elements to stay synchronized.

Browser Support

The mediaGroup attribute is not supported by any mainstream browsers.

Syntax

Sets the mediaGroup attribute:

audio|video.mediaGroup="group"

Returns the mediaGroup attribute:

audio|video.mediaGroup

Attribute value

Value Description
group Specifies the media group for audio/video.

Return value

Type Description
String value Indicates the media group for audio/video.