Commit 42593f80 by Kim Peace

Fixed collaboraiton stop recording for android

parent e3bbf38a
...@@ -20,7 +20,8 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, collaboratio ...@@ -20,7 +20,8 @@ CHAT_SOCKET.handleMessage = function (message, roomName, socketKey, collaboratio
) { ) {
CHAT_SOCKET.cleanUpCollaborationMessage(); CHAT_SOCKET.cleanUpCollaborationMessage();
if (typeof CoviewBridge !== "undefined") { if (typeof CoviewBridge !== "undefined" && g_isMainMan !== "undefined" && g_isMainMan == false) {
console.log("peacekim:: CHAT_SOCKET.handleMessage finishcollaboration");
CoviewBridge.finishCollaboration(); CoviewBridge.finishCollaboration();
} }
return; return;
......
...@@ -87,7 +87,9 @@ function toggleRecord() { ...@@ -87,7 +87,9 @@ function toggleRecord() {
function recordStop() { function recordStop() {
return new Promise(function (done) { return new Promise(function (done) {
console.log("peacekim:: recordStop start");
if (!$("#recordBtn .record").hasClass("disable")) { if (!$("#recordBtn .record").hasClass("disable")) {
console.log("peacekim:: recordStop done 1");
done(); done();
return; return;
} }
...@@ -97,12 +99,14 @@ function recordStop() { ...@@ -97,12 +99,14 @@ function recordStop() {
// アーカイブ保存処理 // アーカイブ保存処理
mainManRecordStopWithCollaboration().then(function () { mainManRecordStopWithCollaboration().then(function () {
console.log("peacekim:: recordStop done 2");
done(); done();
}); });
}); });
} }
async function sendRecordedData() { async function sendRecordedData() {
console.log("peacekim:: sendRecordedData start");
return new Promise(function (done) { return new Promise(function (done) {
// get lastest message id and update message from server via native // 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" });
...@@ -119,26 +123,31 @@ async function sendRecordedData() { ...@@ -119,26 +123,31 @@ async function sendRecordedData() {
formData.append("archiveType", collaborationType); formData.append("archiveType", collaborationType);
postRecords(formData).then(function () { postRecords(formData).then(function () {
console.log("peacekim:: sendRecordedData done 1");
done(); done();
}); });
}); });
} }
function mainManRecordStopWithCollaboration() { function mainManRecordStopWithCollaboration() {
console.log("peacekim:: mainManRecordStopWithCollaboration start");
return new Promise(function (done) { return new Promise(function (done) {
try { try {
mediaRecorder.stop(); mediaRecorder.stop();
} catch (exeption) { } catch (exeption) {
console.error("Record stop failed"); console.error("Record stop failed");
console.log("peacekim:: mainManRecordStopWithCollaboration done 1");
done(); done();
} }
sendRecordedData().then(function () { sendRecordedData().then(function () {
console.log("peacekim:: mainManRecordStopWithCollaboration done 2");
done(); done();
}); });
}); });
} }
function postRecords(formData) { function postRecords(formData) {
console.log("peacekim:: postRecords start");
return new Promise(function (done) { return new Promise(function (done) {
$.ajax({ $.ajax({
type: "post", type: "post",
...@@ -149,11 +158,13 @@ function postRecords(formData) { ...@@ -149,11 +158,13 @@ function postRecords(formData) {
success: function (res) { success: function (res) {
recordFinished(); recordFinished();
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
console.log("peacekim:: postRecords done 1");
done(); done();
}, },
error: function (err) { error: function (err) {
recordFinished(); recordFinished();
Common.dismissLoadingIndicator(); Common.dismissLoadingIndicator();
console.log("peacekim:: postRecords done 2");
done(); done();
}, },
}); });
......
...@@ -198,6 +198,7 @@ CollaborationFeature.didReceiveLoginResponseMessage = async function () { ...@@ -198,6 +198,7 @@ CollaborationFeature.didReceiveLoginResponseMessage = async function () {
} else if (isHost) { } else if (isHost) {
globalUserInfo.meetingID = NativeBridgeDataSource.createContentView(); globalUserInfo.meetingID = NativeBridgeDataSource.createContentView();
if (globalUserInfo.meetingID == "-1") { if (globalUserInfo.meetingID == "-1") {
console.log("peacekim:: didReceiveLoginResponseMessage - finishCollaboration");
//会議室作成失敗 //会議室作成失敗
CoviewBridge.finishCollaboration(); CoviewBridge.finishCollaboration();
return; return;
...@@ -508,17 +509,20 @@ CoviewBridge.exitCollaboration = function () { ...@@ -508,17 +509,20 @@ CoviewBridge.exitCollaboration = function () {
if (globalUserInfo.collaborationType == COLLABORATION_TYPE.DOCUMENT) { if (globalUserInfo.collaborationType == COLLABORATION_TYPE.DOCUMENT) {
NativeBridgeDelegate.exitMeetingRoom(); NativeBridgeDelegate.exitMeetingRoom();
} }
if ($("#recordBtn .record").hasClass("disable")) { if ($("#recordBtn .record").hasClass("disable")) {
recordStop().then(function () { recordStop().then(function () {
console.log("peacekim:: exitCollaboration - finishCollaboration 1");
CoviewBridge.finishCollaboration(); CoviewBridge.finishCollaboration();
}); });
} else { } else {
console.log("peacekim:: exitCollaboration - finishCollaboration 2");
CoviewBridge.finishCollaboration(); CoviewBridge.finishCollaboration();
} }
}; };
CoviewBridge.finishCollaboration = function () { CoviewBridge.finishCollaboration = function () {
console.log("peacekim:: finishCollaboration start");
Common.showLoadingIndicator(); Common.showLoadingIndicator();
coview_api.LeaveRoom(); coview_api.LeaveRoom();
if (coview_api.getRoomUsers()) { if (coview_api.getRoomUsers()) {
......
...@@ -53,6 +53,7 @@ function changeCollaboration(collaborationType) { ...@@ -53,6 +53,7 @@ function changeCollaboration(collaborationType) {
coview_api.ChangeCollaboration("audio"); coview_api.ChangeCollaboration("audio");
newMeetingID = NativeBridgeDataSource.createContentView(); newMeetingID = NativeBridgeDataSource.createContentView();
if (newMeetingID == "-1") { if (newMeetingID == "-1") {
console.log("peacekim:: changeCollaboration to collaborationType doument call finishcollaboration ");
//会議室作成失敗 //会議室作成失敗
CoviewBridge.finishCollaboration(); CoviewBridge.finishCollaboration();
return; return;
......
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