Commit 0d599743 authored by Skye Yu's avatar Skye Yu

add file download finish log

parent 5c9092bc
import { Logger as internalLogger } from './utils/utils';
import {Logger, Logger as internalLogger} from './utils/utils';
const QUERY_DEVICE_INFO = 0x01;
const QUERY_DEVICE_TIME = 0x02;
......@@ -723,7 +723,7 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
function removeAudio() {
const audio = document.getElementById('test_audio');
audio && audio.remove();
audio && audio.pause() && audio.remove();
}
document.addEventListener('visibilitychange', visibilitychange);
......@@ -735,6 +735,7 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
ondata(msg.body);
if (flen >= length) {
document.removeEventListener('visibilitychange', visibilitychange);
Logger.info('file download finish.')
removeAudio();
// return OK indicates all file blocks received
return 'OK';
......@@ -742,6 +743,7 @@ Jensen.prototype.getFile = async function (filename, length, ondata, onprogress)
} else {
document.removeEventListener('visibilitychange', visibilitychange);
removeAudio();
Logger.info('file download 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