diff options
| author | monster_brain <[email protected]> | 2019-01-14 21:43:09 +0530 |
|---|---|---|
| committer | monster_brain <[email protected]> | 2019-01-14 21:43:09 +0530 |
| commit | 8e8a2cbb51220f9d4ff2adcc59cc8dfec502645f (patch) | |
| tree | 70a8cd0a00c9fc4ad7c345d2ef85aadc168755f4 /examples/web/audio/audio_sound_loading.html | |
| parent | 2f9e829f10c4fdf4f7745d7207acd4edbbbaaeb1 (diff) | |
| parent | d7f679d6afe6314264779e1036a5628dfd6bfc2d (diff) | |
| download | raylib.com-8e8a2cbb51220f9d4ff2adcc59cc8dfec502645f.tar.gz raylib.com-8e8a2cbb51220f9d4ff2adcc59cc8dfec502645f.zip | |
Merge branch 'master' of https://github.com/monsterbrain/raylib.com
Diffstat (limited to 'examples/web/audio/audio_sound_loading.html')
| -rw-r--r-- | examples/web/audio/audio_sound_loading.html | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/examples/web/audio/audio_sound_loading.html b/examples/web/audio/audio_sound_loading.html index 3648fb8..7636792 100644 --- a/examples/web/audio/audio_sound_loading.html +++ b/examples/web/audio/audio_sound_loading.html @@ -58,7 +58,7 @@ div.emscripten_border { border: 1px solid black; } /* the canvas *must not* have any border or padding, or mouse coords will be wrong */ - canvas.emscripten { border: 0px none; background: black; } + canvas.emscripten { border: 0px none; background: black; width: 100% } #emscripten_logo { display: inline-block; @@ -159,6 +159,24 @@ <textarea id="output" rows="8"></textarea> + <script type='text/javascript' src="https://cdn.jsdelivr.net/gh/eligrey/FileSaver.js/dist/FileSaver.min.js"> </script> + <script type='text/javascript'> + function SaveFileFromMEMFSToDisk(memoryFSname, localFSname) // This can be called by C/C++ code + { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + var data = FS.readFile(memoryFSname); + var blob; + + if (isSafari) blob = new Blob([data.buffer], {type: "application/octet-stream"}); + else blob = new Blob([data.buffer], {type: "application/octet-binary"}); + + // NOTE: SaveAs Dialog is a browser setting. For example, in Google Chrome, + // in Settings/Advanced/Downloads section you have a setting: + // 'Ask where to save each file before downloading' - which you can set true/false. + // If you enable this setting it would always ask you and bring the SaveAs Dialog + saveAs(blob, localFSname); + } + </script> <script type='text/javascript'> var statusElement = document.getElementById('status'); var progressElement = document.getElementById('progress'); @@ -237,4 +255,5 @@ </script> <script async type="text/javascript" src="audio_sound_loading.js"></script> </body> -</html>
\ No newline at end of file +</html> + |
