Skip to content

Instantly share code, notes, and snippets.

@mindspank
Created December 25, 2016 11:23
Show Gist options
  • Save mindspank/14a50831a5fcfd9100f59c895f242b09 to your computer and use it in GitHub Desktop.
Save mindspank/14a50831a5fcfd9100f59c895f242b09 to your computer and use it in GitHub Desktop.
Base64 in extensions
define(['jquery', './mp3source'], function($, defaultsound) {
return {
initialProperties: {
sound: [{ label: 'Default', value: defaultsound}]
},
paint: function($element, layout) {
$element.empty();
let audio = $(`<audio controls="controls" autobuffer="autobuffer"><source src="data:audio/mp3;base64,${layout.sound[0].value}"/></audio>`);
audio.appendTo($element)
}
}
});
define([], function () {
const sound = `%2F%2FtQBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAVAAAR9AAMDAwMGBgYGBgkJCQkJDAwMDAwPDw8PElJSUlJVVVVVVVhYWFhYW1tbW15eXl5eYaGhoaGkpKSkpKenp6eqqqqqqq2tra2tsPDw8PDz8%2FPz9vb29vb5%2Bfn5%2Bfz8%2FPz8%2F%2F%2F%2F%2F8AAAA5TEFNRTMuOTlyAW4AAAAAAAAAABRAJAJARgAAQAAAEfRXwr31AAAAAAAAAAAAAAAAAAAAAP%2F7UAQAABEdAsoxIhAAJABZNiRCAAVcLTukiMIAo4WocJSYGgAwKkAGHAYGLB%2BCAIAg4uD4P6JxRzPzn%2BUBA4IEz8%2FIf3f%2FWAFAEgAwyBgYsH4IAgCDgGD4PreILus%2FDH%2BUBB3z8Mf3P%2FuqWq7dtmo4kCgC4RALGDTc0PRLCVIamRdCRAMS14RNj94uAavp%2BqLf9d7v%2BZTcksrX9FwiFc6bdqi9EoASSGpgGxhogGJa8Imx7WvFwDV9P1Rb%2F%2F%2FzKorpb5FG0ggAYEQ4UBwVnir%2F%2B1IECAERbBDPaYYZwCxiGcwkwzgFEDNBdPGAIKmGafKeMAaMQwg8EJRhyogc14aZsIi0mPOBZxKR2bxuj%2F%2FUvraVcdbNSiAKAgFBIQLNCEYhhB4ISr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YerAUEwAKgFACJSImY1qqvQFerPBoqdyoKgWRDUioO5YeExoKnZWeTlXDw0Sp1P%2FkfLExBTUUzLjk5LjOqqv%2F7UgRtAAG2DU1gyTAgN0GprBkmBAX4IyMkpGBAwIRkGJSMCKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq`
return sound;
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment