in my case I want to play MP3 file by just drag and drop the file on Cocos Canvas.
after drop we can read file in various data type, for me i choose DataURL.
now i really can’t make clip by the read data.
here the existing code that doesn’t work:
let reader = new FileReader()
reader.onload = (data) => {
let result = data.target.result
cc.loader.load(result, (err, res) => {
if (!err) {
// don't know how to make make clip by res
let clip = res
} else {
alert(err)
}
})
}
reader.readAsDataURL(file)
is there anyone ever try the case?
please give me the advise, thanks