summaryrefslogtreecommitdiffhomepage
path: root/src/shell.html
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-22 12:33:28 +0200
committerRay <[email protected]>2019-05-22 12:33:28 +0200
commit7421ac9e24095a4104285691a7b4fa620629277d (patch)
tree3a2b403415babd0963023f81e7d4e74ecebae17a /src/shell.html
parenta33b0002ee599670a3de5e52f4dcc0e226fb4f61 (diff)
downloadraylib-7421ac9e24095a4104285691a7b4fa620629277d.tar.gz
raylib-7421ac9e24095a4104285691a7b4fa620629277d.zip
Add code to resume blocked AudioContexts
Diffstat (limited to 'src/shell.html')
-rw-r--r--src/shell.html53
1 files changed, 48 insertions, 5 deletions
diff --git a/src/shell.html b/src/shell.html
index 42cd711a..a0e730e1 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -85,7 +85,8 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
margin: 0;
margin-top: 20px;
margin-left: 20px;
- display: inline-block; vertical-align: top;
+ display: inline-block;
+ vertical-align: top;
-webkit-animation: rotation .8s linear infinite;
-moz-animation: rotation .8s linear infinite;
-o-animation: rotation .8s linear infinite;
@@ -253,8 +254,7 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
-
- if (!text) spinnerElement.hidden = true;
+ if (!text) spinnerElement.style.display = 'none';
}
statusElement.innerHTML = text;
@@ -263,7 +263,8 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
- }
+ },
+ //noInitialRun: true
};
Module.setStatus('Downloading...');
@@ -274,6 +275,48 @@ jwE50AGjLCVuS8Yt4H7OgZLKK5EKOsLviEWJSL/+0uMi7gLUSBseYwqEbXvSHCec1CJvZPyHCmYQffaB
Module.setStatus = function(text) { if (text) Module.printErr('[post-exception status] ' + text); };
};
</script>
+
+ <!-- NOTE: This code snippet displays a button that resumes blocked AudioContexts by
+ the autoplay policy. For more detail on the autoplay change in Chrome, check:
+ https://developers.google.com/web/updates/2017/09/autoplay-policy-changes#webaudio. -->
+ <script type='text/javascript'>
+ /*
+ * Copyright 2018 Google Inc. All Rights Reserved.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ (function() {
+ const list = [];
+ self.AudioContext = new Proxy(self.AudioContext, {
+ construct(target, args) {
+ const result = new target(...args);
+ list.push(result);
+ return result;
+ }
+ });
+
+ const btn = document.createElement('button');
+
+ btn.classList.add('unmute');
+ btn.style.position = 'fixed';
+ btn.style.bottom = '0';
+ btn.style.right = '0';
+ btn.textContent = '🔇 Unmute';
+ btn.style.fontSize = '5em';
+ btn.onclick = e => {
+ list.forEach(ctx => ctx.resume());
+ btn.remove();
+ };
+
+ document.addEventListener('DOMContentLoaded', _ => { document.body.appendChild(btn); });
+ })();
+ </script>
{{{ SCRIPT }}}
</body>
-</html> \ No newline at end of file
+</html>