Commit 4d19a6c1 by Kim Peace

Fixed to wait to finish callboration for send recorded data

parent 9d625253
......@@ -102,15 +102,9 @@ function recordStop(callback) {
);
}
function mainManRecordWithCollaboration(action, url, callback) {
try {
mediaRecorder.stop();
} catch (exeption) {
console.error("Record failed");
callback();
}
setTimeout(function () {
async function sendRecordedData(url, callback) {
return new Promise(function (done) {
// get lastest message id and update message from server via native
const blob = new Blob(recordedBlobs, { type: "video/webm" });
const uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++;
......@@ -124,8 +118,21 @@ function mainManRecordWithCollaboration(action, url, callback) {
: ARCHIVE_TYPE.VOICE;
formData.append("archiveType", collaborationType);
postRecords(url, formData, callback);
}, 1000);
postRecords(url, formData, function () {
done();
callback();
});
});
}
function mainManRecordWithCollaboration(action, url, callback) {
try {
mediaRecorder.stop();
} catch (exeption) {
console.error("Record failed");
callback();
}
sendRecordedData(url, callback);
}
function postRecords(url, formData, callback) {
......
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