Audio mediaGroup Attribute

Definition and Usage

mediaGroup Property to set or return the name of the media group to which the audio belongs.

Media groups allow 2 or more <audio> elements to stay synchronized.

Instance

Set media groups for two <audio> elements:

var x = document.getElementById("myAudio1");
var y = document.getElementById("myAudio2");
x.mediaGroup = "test";
y.mediaGroup = "test";

Try It Yourself

Syntax

Return the mediaGroup property:

audioObject.mediaGroup

Set the mediaGroup property:

audioObject.mediaGroup = group

Attribute Value

Value Description
group Specifies the media group of the audio.

Technical Details

Return Value: A string value representing the media group of the audio.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support