Browse Source

Revert "Examples: Moved video element creation to script."

This reverts commit 95db0342deeb7c99b6abb66e31abc272df83908c.
Mr.doob 5 năm trước cách đây
mục cha
commit
6df8749139
1 tập tin đã thay đổi với 7 bổ sung16 xóa
  1. 7 16
      examples/webgl_kinect.html

+ 7 - 16
examples/webgl_kinect.html

@@ -8,6 +8,11 @@
 	</head>
 	</head>
 	<body>
 	<body>
 
 
+		<video id="video" loop muted crossOrigin="anonymous" playsinline style="display:none">
+			<source src="textures/kinect.webm">
+			<source src="textures/kinect.mp4">
+		</video>
+
 		<script id="vs" type="x-shader/x-vertex">
 		<script id="vs" type="x-shader/x-vertex">
 
 
 			uniform sampler2D map;
 			uniform sampler2D map;
@@ -95,22 +100,7 @@
 				center = new THREE.Vector3();
 				center = new THREE.Vector3();
 				center.z = - 1000;
 				center.z = - 1000;
 
 
-				//
-
-				var video = document.createElement( 'video' );
-				video.crossOrigin = 'anonymous';
-				video.loop = true;
-				video.muted = true;
-				video.playsinline = true; // Safari/iOS
-
-				var source = document.createElement( 'source' );
-				source.src = 'textures/kinect.webm';
-				video.appendChild( source );
-
-				var source = document.createElement( 'source' );
-				source.src = 'textures/kinect.mp4';
-				video.appendChild( source );
-
+				var video = document.getElementById( 'video' );
 				video.addEventListener( 'loadedmetadata', function () {
 				video.addEventListener( 'loadedmetadata', function () {
 
 
 					var texture = new THREE.VideoTexture( video );
 					var texture = new THREE.VideoTexture( video );
@@ -162,6 +152,7 @@
 					gui.add( material.uniforms.farClipping, 'value', 1, 10000, 1.0 ).name( 'farClipping' );
 					gui.add( material.uniforms.farClipping, 'value', 1, 10000, 1.0 ).name( 'farClipping' );
 					gui.add( material.uniforms.pointSize, 'value', 1, 10, 1.0 ).name( 'pointSize' );
 					gui.add( material.uniforms.pointSize, 'value', 1, 10, 1.0 ).name( 'pointSize' );
 					gui.add( material.uniforms.zOffset, 'value', 0, 4000, 1.0 ).name( 'zOffset' );
 					gui.add( material.uniforms.zOffset, 'value', 0, 4000, 1.0 ).name( 'zOffset' );
+					gui.close();
 
 
 
 
 				}, false );
 				}, false );