git.s-ol.nu xxy-oscilloscope / 00abb23
add chrome autoplay-policy overlay s-ol 2 months ago
2 changed file(s) with 27 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1010 border-spacing:0;
1111 border-collapse: collapse;
1212 }
13
13 #startOverlay {
14 display: block;
15 position: fixed;
16 width: 100vw;
17 height: 100vh;
18 background: rgba(0, 0, 0, 0.4);
19 color: rgb(255, 255, 255);
20 font-size: 10vh;
21 top: 0;
22 left: 0;
23 text-align: center;
24 padding-top: 45vh;
25 cursor: pointer;
26 }
1427 </style>
1528 </head>
1629
5770 else element.style.display = "none";
5871 }
5972
60
61
62 </script>
73 </script>
74
75 <div id="startOverlay">START</div>
6376
6477 <table align="center">
6578 <tbody><tr>
5353
5454 startSound : function()
5555 {
56 if (this.audioContext.state == 'suspended') {
57 var overlay = document.getElementById("startOverlay");
58 overlay.style.display="block";
59 overlay.addEventListener('click', () => {
60 this.audioContext.resume();
61 overlay.style.display="none";
62 });
63 }
64
5665 var audioElement = document.getElementById("audioElement");
5766 this.source = this.audioContext.createMediaElementSource(audioElement);
5867 this.audioVolumeNode = this.audioContext.createGain();
465474 {
466475 var windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
467476 var windowHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
468 var canvasSize = Math.min(windowHeight-21, windowWidth - UI.sidebar.getBoundingClientRect().width - 70);
477 var canvasSize = Math.min(windowHeight - 42, windowWidth - UI.sidebar.getBoundingClientRect().width - 21);
469478 Render.canvas.width = canvasSize;
470479 Render.canvas.height = canvasSize;
471480 if (Render.lineTexture)