Commit 4d19a6c1 by Kim Peace

Fixed to wait to finish callboration for send recorded data

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