Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html> 
<html> 
<body> 
<video id="myVideo1" width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>
<video id="myVideo2" width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video><br>
<button onclick="setMedGroup()" type="button">Set media group for videos</button>
<button onclick="getMedGroup()" type="button">Get media group for videos</button>
<script>
var x = document.getElementById("myVideo1");
var y = document.getElementById("myVideo2");
function setMedGroup() { 
  x.mediaGroup = "test";
  y.mediaGroup = "test";
} 
function getMedGroup() { 
  alert("Video 1 media group: " + x.mediaGroup +
  ". Video 2 media group: " + y.mediaGroup);
} 
</script> 
</body> 
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_video_mediagroup by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 18:17:03 GMT -->
</html>