Commit e3bbf38a by Kim Peace

Merge branch 'bug/#44334_recoding_related_in_collaboration' into 'develop'

Fixed to wait to finish callboration for send recorded data

See merge request !252
parents 9d625253 567c9b9c
...@@ -171,7 +171,7 @@ FermiWebSocketMessageHandler.captureRequest = function (data) { ...@@ -171,7 +171,7 @@ FermiWebSocketMessageHandler.captureRequest = function (data) {
if ($("#recordBtn .record").hasClass("disable")) { if ($("#recordBtn .record").hasClass("disable")) {
screenLock(); screenLock();
recordStop(function () { recordStop().then(function () {
$("#screenLock").remove(); $("#screenLock").remove();
captureAndShareImage( captureAndShareImage(
serverInfo.cmsURL + "/chatapi/file/uploadArchive", serverInfo.cmsURL + "/chatapi/file/uploadArchive",
...@@ -222,7 +222,7 @@ FermiWebSocketMessageHandler.pipEndRequest = function () { ...@@ -222,7 +222,7 @@ FermiWebSocketMessageHandler.pipEndRequest = function () {
FermiWebSocketMessageHandler.apiSendOwnerChangeComplete = function (data) { FermiWebSocketMessageHandler.apiSendOwnerChangeComplete = function (data) {
penOff(); penOff();
if ($("#recordBtn .record").hasClass("disable")) { if ($("#recordBtn .record").hasClass("disable")) {
recordStop(function () {}); recordStop();
} }
if ($("#micBtn .voice").hasClass("disable")) { if ($("#micBtn .voice").hasClass("disable")) {
micOff(); micOff();
...@@ -262,7 +262,7 @@ FermiWebSocketMessageHandler.changeHostApplyForHost = function (data) { ...@@ -262,7 +262,7 @@ FermiWebSocketMessageHandler.changeHostApplyForHost = function (data) {
FermiWebSocketBridge.hostRequestReject(hostID); FermiWebSocketBridge.hostRequestReject(hostID);
//上の実行した後、「CHANGE_HOST_APPLY」が受信され、ステータスが「DOING」になるので1秒後に実行 //上の実行した後、「CHANGE_HOST_APPLY」が受信され、ステータスが「DOING」になるので1秒後に実行
setTimeout(function () { setTimeout(function () {
NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE); NativeBridgeDelegate.setHostRequestFlg(HostRequestFlag.DONE);
}, 1000); }, 1000);
} }
FermiWebSocketBridge.hostRequestDone(hostID); FermiWebSocketBridge.hostRequestDone(hostID);
......
...@@ -28,7 +28,7 @@ function toggleEraser() { ...@@ -28,7 +28,7 @@ function toggleEraser() {
function toggleCapture() { function toggleCapture() {
if ($("#recordBtn").hasClass("bg_red")) { if ($("#recordBtn").hasClass("bg_red")) {
screenLock(); screenLock();
recordStop(function () { recordStop().then(function () {
$("#screenLock").remove(); $("#screenLock").remove();
coview_api.Capture(serverInfo.cmsURL + "/chatapi/file/uploadArchive"); coview_api.Capture(serverInfo.cmsURL + "/chatapi/file/uploadArchive");
}); });
...@@ -79,38 +79,32 @@ function toggleRecord() { ...@@ -79,38 +79,32 @@ function toggleRecord() {
if (!$("#recordBtn .record").hasClass("disable")) { if (!$("#recordBtn .record").hasClass("disable")) {
recordStart(); recordStart();
} else { } else {
recordStop(function () { recordStop().then(function () {
console.info("Did record stop"); console.info("Did record stop");
}); });
} }
} }
function recordStop(callback) { function recordStop() {
if (!$("#recordBtn .record").hasClass("disable")) { return new Promise(function (done) {
callback(); if (!$("#recordBtn .record").hasClass("disable")) {
return; done();
} return;
Common.showLoadingIndicator(); }
// アーカイブ保存中は画面操作不可(協業終了,協業切り替え防止) Common.showLoadingIndicator();
screenLock(); // アーカイブ保存中は画面操作不可(協業終了,協業切り替え防止)
screenLock();
// アーカイブ保存処理
mainManRecordWithCollaboration(
"stop",
serverInfo.cmsURL + "/chatapi/file/uploadArchive",
callback
);
}
function mainManRecordWithCollaboration(action, url, callback) {
try {
mediaRecorder.stop();
} catch (exeption) {
console.error("Record failed");
callback();
}
setTimeout(function () { // アーカイブ保存処理
mainManRecordStopWithCollaboration().then(function () {
done();
});
});
}
async function sendRecordedData() {
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 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,27 +118,45 @@ function mainManRecordWithCollaboration(action, url, callback) { ...@@ -124,27 +118,45 @@ function mainManRecordWithCollaboration(action, url, callback) {
: ARCHIVE_TYPE.VOICE; : ARCHIVE_TYPE.VOICE;
formData.append("archiveType", collaborationType); formData.append("archiveType", collaborationType);
postRecords(url, formData, callback); postRecords(formData).then(function () {
}, 1000); done();
} });
});
function postRecords(url, formData, callback) { }
$.ajax({
type: "post", function mainManRecordStopWithCollaboration() {
url: url, return new Promise(function (done) {
data: formData, try {
contentType: false, mediaRecorder.stop();
processData: false, } catch (exeption) {
success: function (res) { console.error("Record stop failed");
recordFinished(); done();
Common.dismissLoadingIndicator(); }
callback(); sendRecordedData().then(function () {
}, done();
error: function (err) { });
recordFinished(); });
Common.dismissLoadingIndicator(); }
callback();
}, function postRecords(formData) {
return new Promise(function (done) {
$.ajax({
type: "post",
url: serverInfo.cmsURL + "/chatapi/file/uploadArchive",
data: formData,
contentType: false,
processData: false,
success: function (res) {
recordFinished();
Common.dismissLoadingIndicator();
done();
},
error: function (err) {
recordFinished();
Common.dismissLoadingIndicator();
done();
},
});
}); });
} }
......
...@@ -510,7 +510,9 @@ CoviewBridge.exitCollaboration = function () { ...@@ -510,7 +510,9 @@ CoviewBridge.exitCollaboration = function () {
} }
if ($("#recordBtn .record").hasClass("disable")) { if ($("#recordBtn .record").hasClass("disable")) {
recordStop(CoviewBridge.finishCollaboration); recordStop().then(function () {
CoviewBridge.finishCollaboration();
});
} else { } else {
CoviewBridge.finishCollaboration(); CoviewBridge.finishCollaboration();
} }
......
...@@ -28,7 +28,7 @@ document.addEventListener("DOMContentLoaded", function () { ...@@ -28,7 +28,7 @@ document.addEventListener("DOMContentLoaded", function () {
// call from collaboration_overlay_menu.html and collaboration.html // call from collaboration_overlay_menu.html and collaboration.html
function changeCollaboration(collaborationType) { function changeCollaboration(collaborationType) {
recordStop(function () { recordStop().then(function () {
var newMeetingID = 0; var newMeetingID = 0;
if (globalUserInfo.collaborationType == COLLABORATION_TYPE.DOCUMENT) { if (globalUserInfo.collaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom(); NativeBridgeDelegate.exitMeetingRoom();
......
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