Libraryless. Click here for Pure Java version (3098L/20K).
1 | sS hjs_playHum() { |
2 | ret hjs(replaceDollarVars([[ |
3 | var humSound = new Audio($url); |
4 | var humSoundCanPlay = false, humSoundPlaying = false; |
5 | humSound.loop = true; |
6 | |
7 | humSound.oncanplaythrough = function() { |
8 | humSoundCanPlay = true; |
9 | }; |
10 | |
11 | // start playing and/or change volume |
12 | function hum(volume) { |
13 | humSound.volume = volume; |
14 | if (humSoundPlaying) return; |
15 | humSoundPlaying = true; |
16 | humSound.play(); |
17 | } |
18 | |
19 | function stopHum() { |
20 | if (!humSoundPlaying) return; |
21 | humSoundPlaying = false; |
22 | humSound.stop(); |
23 | } |
24 | ]], url := jsQuote(dataSnippetLink(#1400406)))); |
25 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028687 |
Snippet name: | hjs_playHum |
Eternal ID of this version: | #1028687/7 |
Text MD5: | 45c7289aae719501e42a03c5802d7760 |
Transpilation MD5: | a955088461f1f2340734b562cd683de5 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-05 21:09:26 |
Source code size: | 659 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 220 / 330 |
Version history: | 6 change(s) |
Referenced in: | [show references] |