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