Skip to content

Commit eea2a6b

Browse files
committed
remove redundant play function call
1 parent 6fb1010 commit eea2a6b

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

main.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ async function main(embedURL) {
7171
let textGroup, textMesh, textGeo, textMaterials;
7272
let text = `Outside the virtual computer:\n\nLeft-click to rotate\nRight-click to pan\nScroll wheel for zoom`, font = 'helvetiker'
7373
const textHeight = 0,
74-
size = 0.015,
75-
hover = 0.51,
76-
curveSegments = 4
74+
size = 0.015,
75+
hover = 0.51,
76+
curveSegments = 4
7777

7878
textMaterials = [
7979
new THREE.MeshPhongMaterial( { color: 0xffffff, flatShading: true } ), // front
@@ -144,13 +144,10 @@ async function main(embedURL) {
144144
animate()
145145

146146
function tryAudio(track) {
147+
// sound.play() does not need to be called when calling setMediaStreamSource
148+
// See https://threejs.org/docs/#api/en/audio/Audio.setMediaStreamSource
147149
sound.setMediaStreamSource(new MediaStream([track]))
148150
sound.setRefDistance(0.5)
149-
// The audio context might be waiting on a user gesture
150-
// In that case, we'll call sound.play() in the pointerdown handler
151-
if (listener.context.state === "running") {
152-
sound.play()
153-
}
154151
}
155152

156153
function onWindowResized() {
@@ -215,7 +212,6 @@ async function main(embedURL) {
215212
// resume the audio context now since the user interacted with the page
216213
if (listener.context.state === "suspended") {
217214
await listener.context.resume()
218-
await sound.play()
219215
}
220216
}
221217

@@ -243,7 +239,6 @@ function checkerboardMesh(width, segments) {
243239
})
244240
const positionAttribute = geometry.getAttribute("position")
245241
const colors = []
246-
console.log(segments * segments, positionAttribute.count / 6)
247242
for (let i = 0; i < positionAttribute.count; i++) {
248243
colors.push(0, 0, 0, i % 6 === i % 12 ? 1 : 0)
249244
}

0 commit comments

Comments
 (0)