- Notifications
You must be signed in to change notification settings - Fork3
Base64 generator for waud.js
License
waud/waudbase64
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Base64 generator forwaud.js
Base64 decoding is widely supported across all browsers.
npm install -g waudbase64
waudbase64 -i sounds -o sounds.json
waudbase64 --helpinfo: Usage: waudbase64 -i sounds -o sounds.jsoninfo: Options: --input, -i input folder (default: ./) --output, -o output JSON file (default: sounds.json) --noBasePath, --nb doesn't prepend base path to each asset id --help, -h help
var base64pack = new WaudBase64Pack("assets/sounds.json", _onLoad);function _onLoad(snds:Map<String, IWaudSound>) { snds.get("assets/beep.mp3").play();}
http://waud.github.io/sample/base64.html
Note that the file size of base64 encoded JSON file will be more than the actual sound file(s).
But if your web server havegzip compression enabled for JSON files then the network transfer size will be smaller than loading individual sound files.
Enablinggzip compression is a standard practice and most likely your web server has it enabled already and to verify that you can open the network tab in chrome developer tools and click on any JSON file that's loaded. If you noticeContent-Encoding:gzip
in Response Headers section then it's already enabled.
Some numbers for example:
Size of 6 individual mp3 sound files before base64 encoding:589 KB
Size of base64 encoded JSON with all the 6 sounds:785 KB
Network transfer size withgzip enabled:552 KB
This content is released under theMIT License.
Code of Conduct is adapted fromContributor Covenant, version 1.4