Loads a sound from a data url.
Please be aware that browsers do support different kinds of audio types.
You can get a list of supported types here: Sound.supportedTypes
var sound = await Sound.loadDataUrl("data:audio/mpeg;base64,<data>");
sound.play();
Source
static Future<Sound> loadDataUrl( String dataUrl, [SoundLoadOptions soundLoadOptions]) async { var options = soundLoadOptions ?? Sound.defaultLoadOptions; var audioContext = WebAudioApiMixer.audioContext; var start = dataUrl.indexOf(',') + 1; var bytes = BASE64.decoder.convert(dataUrl, start) as Uint8List; try { var audioData = bytes.buffer; var audioBuffer = await audioContext.decodeAudioData(audioData); return new WebAudioApiSound._(audioBuffer); } catch (e) { if (options.ignoreErrors) { return MockSound.loadDataUrl(dataUrl, options); } else { throw new LoadError("Failed to load sound.", e); } } }