This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detect autoplay | |
// --------------- | |
// This script detects whether the current browser supports the | |
// autoplay feature for HTML5 Audio elements, and it sets the | |
// `AUTOPLAY` variable accordingly. | |
// Used in the Meteor app [PicDinner](http://picdinner.com) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getBase64FromImage(url, onSuccess, onError) { | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType = "arraybuffer"; | |
xhr.open("GET", url); | |
xhr.onload = function () { | |
var base64, binary, bytes, mediaType; | |
bytes = new Uint8Array(xhr.response); |