add chrome autoplay-policy overlay
s-ol
3 years ago
9 | 9 |
border-spacing:0;
|
10 | 10 |
border-collapse: collapse;
|
11 | 11 |
}
|
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 |
}
|
13 | 26 |
</style>
|
14 | 27 |
</head>
|
15 | 28 |
|
|
56 | 69 |
else element.style.display = "none";
|
57 | 70 |
}
|
58 | 71 |
|
59 | |
|
60 | |
|
61 | |
</script>
|
|
72 |
</script>
|
|
73 |
|
|
74 |
<div id="startOverlay">START</div>
|
62 | 75 |
|
63 | 76 |
<table align="center">
|
64 | 77 |
<tbody><tr>
|
52 | 52 |
|
53 | 53 |
startSound : function()
|
54 | 54 |
{
|
|
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 |
|
55 | 64 |
var audioElement = document.getElementById("audioElement");
|
56 | 65 |
this.source = this.audioContext.createMediaElementSource(audioElement);
|
57 | 66 |
this.audioVolumeNode = this.audioContext.createGain();
|
|
464 | 473 |
{
|
465 | 474 |
var windowWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
|
466 | 475 |
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);
|
468 | 477 |
Render.canvas.width = canvasSize;
|
469 | 478 |
Render.canvas.height = canvasSize;
|
470 | 479 |
if (Render.lineTexture)
|