Commit 6f6cb1db authored by Skye Yu's avatar Skye Yu

remove audio node

parent d218d287
...@@ -721,6 +721,11 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress) ...@@ -721,6 +721,11 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
} }
} }
function removeAudio() {
const audio = document.getElementById('test_audio');
audio && audio.remove();
}
document.addEventListener('visibilitychange', visibilitychange); document.addEventListener('visibilitychange', visibilitychange);
let flen = 0; let flen = 0;
...@@ -730,11 +735,13 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress) ...@@ -730,11 +735,13 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
ondata(msg.body); ondata(msg.body);
if (flen >= length) { if (flen >= length) {
document.removeEventListener('visibilitychange', visibilitychange); document.removeEventListener('visibilitychange', visibilitychange);
removeAudio();
// return OK indicates all file blocks received // return OK indicates all file blocks received
return 'OK'; return 'OK';
} }
} else { } else {
document.removeEventListener('visibilitychange', visibilitychange); document.removeEventListener('visibilitychange', visibilitychange);
removeAudio();
ondata('fail'); ondata('fail');
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment