Explorar el Código

Examples: Autoplay sintel video, remove Play overlay.

Adds muted to the <video> element and drops the click-to-play overlay
so the sintel examples start playing immediately on page load. Matches
the pattern already used by webgl_video_kinect,
webgl_video_panorama_equirectangular, webgpu_video_panorama, etc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Mr.doob hace 1 día
padre
commit
f3fa844ba4
Se han modificado 2 ficheros con 4 adiciones y 27 borrados
  1. 2 13
      examples/webgl_materials_video.html
  2. 2 14
      examples/webgpu_materials_video.html

+ 2 - 13
examples/webgl_materials_video.html

@@ -8,9 +8,6 @@
 	</head>
 	<body>
 
-		<div id="overlay">
-			<button id="startButton">Play</button>
-		</div>
 		<div id="container"></div>
 
 		<div id="info">
@@ -18,7 +15,7 @@
 			playing <a href="http://durian.blender.org/" target="_blank" rel="noopener">sintel</a> trailer
 		</div>
 
-		<video id="video" loop crossOrigin="anonymous" playsinline style="display:none">
+		<video id="video" loop muted crossOrigin="anonymous" playsinline style="display:none">
 			<source src="textures/sintel.ogv" type='video/ogg; codecs="theora, vorbis"'>
 			<source src="textures/sintel.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
 		</video>
@@ -63,18 +60,10 @@
 				xgrid = 20,
 				ygrid = 10;
 
-			const startButton = document.getElementById( 'startButton' );
-			startButton.addEventListener( 'click', function () {
-
-				init();
-
-			} );
+			init();
 
 			function init() {
 
-				const overlay = document.getElementById( 'overlay' );
-				overlay.remove();
-
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 

+ 2 - 14
examples/webgpu_materials_video.html

@@ -8,10 +8,6 @@
 	</head>
 	<body>
 
-		<div id="overlay">
-			<button id="startButton">Play</button>
-		</div>
-
 		<div id="container"></div>
 
 		<div id="info">
@@ -26,7 +22,7 @@
 			</small>
 		</div>
 
-		<video id="video" loop crossOrigin="anonymous" playsinline style="display:none">
+		<video id="video" loop muted crossOrigin="anonymous" playsinline style="display:none">
 			<source src="textures/sintel.ogv" type='video/ogg; codecs="theora, vorbis"'>
 			<source src="textures/sintel.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
 		</video>
@@ -66,18 +62,10 @@
 				xgrid = 20,
 				ygrid = 10;
 
-			const startButton = document.getElementById( 'startButton' );
-			startButton.addEventListener( 'click', function () {
-
-				init();
-
-			} );
+			init();
 
 			function init() {
 
-				const overlay = document.getElementById( 'overlay' );
-				overlay.remove();
-
 				container = document.createElement( 'div' );
 				document.body.appendChild( container );
 

粤ICP备19079148号