Created
May 8, 2016 05:21
-
-
Save clinyong/62d4efa81207c04a3ee691cdd9895e79 to your computer and use it in GitHub Desktop.
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
var audioCtx = new AudioContext(); | |
var source = audioCtx.createBufferSource(); | |
fetch( | |
'http://7xsym0.com2.z0.glb.qiniucdn.com/%E9%82%93%E7%B4%AB%E6%A3%8B%20-%20A.I.N.Y.%2528%E7%88%B1%E4%BD%A0%2529.mp3', { | |
}) | |
.then(function(resp){ | |
resp.arrayBuffer().then(function(buffer){ | |
audioCtx.decodeAudioData(buffer, function(decodedData) { | |
source.buffer = decodedData; | |
source.connect(audioCtx.destination); | |
source.start(0); | |
}) | |
}) | |
}).catch(function(e){ | |
console.log(e) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment