Commit 2f0d9078 by Kim Peace

Merge branch 'develop' into refactoring/prettier

# Conflicts:
#	public_new/js/chat-ui.js
#	public_new/js/collaboration.js
#	public_new/js/share.js
parents 00c4c2ac b8fab3f1
......@@ -2,14 +2,14 @@
<div class="footer-wrap">
<div class="d-flex justify-content-around h-100">
<div class="footer_item">
<a href="#">
<a href="javascript:micTogle();">
<div class="img_wrap bg_red" id="micBtn">
<img src="icon/icon_voice_gray.png" alt="音声">
</div>
</a>
</div>
<div class="footer_item none host_contents">
<a href="#">
<a href="javascript:recordTogle();">
<div class="img_wrap bg_gray" id="recordBtn">
<img src="icon/icon_record.png" alt="録音">
</div>
......
......@@ -40,7 +40,7 @@ CHAT_UI.startCollaboration = function (collaborationType) {
0
);
if (CHAT_UTIL.isIOS()) {
//TODO ルーム全協業終了API
webkit.messageHandlers.finishAllCollaboration.postMessage({});
} else if (CHAT_UTIL.isAndroid()) {
android.finishAllCollaboration();
}
......
function recordStart() {
MainManRecord("on");
$("#recordBtn").removeClass("bg_gray");
$("#recordBtn").addClass("bg_red");
}
function recordStop(callback) {
// アーカイブ保存中は画面操作不可(協業終了,協業切り替え防止)
screenLock();
// アーカイブ保存処理
MainManRecordWithCollaboration(
"stop",
CMS_SERVER_URL + "/chatapi/file/uploadArchive",
callback
);
}
function MainManRecordWithCollaboration(action, url, callback) {
mediaRecorder.stop();
console.log("Recorded Blobs: ", recordedBlobs);
setTimeout(function () {
console.log("Recoding File upload..");
const blob = new Blob(recordedBlobs, { type: "video/webm" });
console.log(blob);
var uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++;
var formData = new FormData();
formData.append("fileData", blob, uploadFileName);
formData.append("sid", globalUserInfo.sid);
formData.append("roomId", globalUserInfo.roomId);
if (joinCollaborationType == COLLABORATION_TYPE.VIDEO) {
formData.append("archiveType", 1);
} else {
formData.append("archiveType", 2);
}
console.log(uploadFileName);
$.ajax({
type: "post",
url,
data: formData,
contentType: false,
processData: false,
success: function (res) {
recordFinished();
callback();
console.log(res);
},
error: function (err) {
recordFinished();
callback();
console.log(err);
},
});
}, 1000);
}
function screenLock() {
// ロック用のdivを生成
var element = document.createElement("div");
element.id = "screenLock";
// ロック用のスタイル
element.style.height = "100%";
element.style.left = "0px";
element.style.position = "fixed";
element.style.top = "0px";
element.style.width = "100%";
element.style.zIndex = "9999";
element.style.opacity = "0";
var objBody = document.getElementsByTagName("body").item(0);
objBody.appendChild(element);
}
// div削除関数
function delete_dom_obj(id_name) {
var dom_obj = document.getElementById(id_name);
var dom_obj_parent = dom_obj.parentNode;
dom_obj_parent.removeChild(dom_obj);
}
function recordFinished() {
$("#recordBtn").addClass("bg_gray");
$("#recordBtn").removeClass("bg_red");
// ロック画面の削除
delete_dom_obj("screenLock");
}
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener("DOMContentLoaded", function () {
// メニューオーバーレイ表示
$(".menu_btn").click(function () {
var w = $(this).width();
......@@ -195,15 +105,6 @@ document.addEventListener('DOMContentLoaded', function() {
$("#coviewEraserCtrBtn").click();
});
$("#micBtn").click(function () {
$("#coviewMicCtrBtn").click();
if ($("#micBtn").hasClass("bg_red")) {
micOn();
} else {
micOff();
}
});
$("#captureBtn").click(function () {
if ($("#recordBtn").hasClass("bg_red")) {
screenLock();
......@@ -221,14 +122,6 @@ document.addEventListener('DOMContentLoaded', function() {
name: CHAT.globalLoginParameter.loginId,
});
});
$("#recordBtn").click(function () {
if ($("#recordBtn").hasClass("bg_gray")) {
recordStart();
} else {
recordStop(null);
}
});
});
function penOff() {
......@@ -238,15 +131,3 @@ function penOff() {
$("#penBtn").removeClass("bg_blue");
}
}
function micOn() {
coview_api.MicMuteControl("off");
$("#micBtn").addClass("bg_blue");
$("#micBtn").removeClass("bg_red");
}
function micOff() {
coview_api.MicMuteControl("on");
$("#micBtn").removeClass("bg_blue");
$("#micBtn").addClass("bg_red");
}
......@@ -154,8 +154,8 @@ document.addEventListener("DOMContentLoaded", function () {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.joinChangedCollaboration.postMessage({
"joinCollaborationType": joinCollaborationType,
"meetingId": data.payload.newMeetingId,
joinCollaborationType: joinCollaborationType,
meetingId: data.payload.newMeetingId,
});
if (joinCollaborationType == COLLABORATION_TYPE.DOCUMENT) {
webkit.messageHandlers.joinMeetingRoom.postMessage(
......@@ -227,10 +227,16 @@ document.addEventListener("DOMContentLoaded", function () {
Coview_changeHost(getFermiLoginId(data.payload.loginId));
}
} else if (data.type === "API_SEND_OWNER_CHANGE_COMPLETE") {
penOff();
if ($("#recordBtn").hasClass("bg_red")) {
recordStop(penOff);
recordStop(function () {
console.log("ホスト変更によりレコードを終了しました");
});
}
if ($("#micBtn").hasClass("bg_red")) {
micOff();
} else {
penOff();
micOn();
}
} else if (data.type === "CHANGE_HOST_APPLY") {
if (CHAT_UTIL.isAndroid()) {
......@@ -505,7 +511,9 @@ function changeCollaboration(changeCollaborationType) {
}
joinCollaborationType = changeCollaborationType;
if ($("#recordBtn").hasClass("bg_red")) {
recordStop(null);
recordStop(function () {
console.log("レコードを終了しました");
});
}
initCollaborationUI(changeCollaborationType);
switch (changeCollaborationType) {
......@@ -539,8 +547,8 @@ function changeCollaboration(changeCollaborationType) {
penOff();
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.changeCollaboration.postMessage({
"changeCollaborationType": changeCollaborationType,
"meetingId": newMeetingId,
changeCollaborationType: changeCollaborationType,
meetingId: newMeetingId,
});
} else if (CHAT_UTIL.isAndroid()) {
android.changeCollaboration(changeCollaborationType, newMeetingId);
......@@ -565,7 +573,7 @@ var scrollLock = function (e) {
}
};
let collaboScreen = document.getElementById("collabo_main");
// let collaboScreen = document.getElementById("collabo_main");
function scrollLockON() {
collaboScreen.addEventListener("touchmove", scrollLock, { passive: false });
......@@ -940,3 +948,124 @@ function captureAndShareImage(urls, changeHostName) {
});
});
}
function micOn() {
coview_api.MicMuteControl("off");
$("#micBtn").addClass("bg_blue");
$("#micBtn").removeClass("bg_red");
}
function micOff() {
coview_api.MicMuteControl("on");
$("#micBtn").removeClass("bg_blue");
$("#micBtn").addClass("bg_red");
}
function micTogle() {
if ($("#micBtn").hasClass("bg_red")) {
micOn();
} else {
micOff();
}
}
function recordStart() {
console.log("レコードを開始しました");
MainManRecord("on");
$("#recordBtn").removeClass("bg_gray");
$("#recordBtn").addClass("bg_red");
}
function recordFinished() {
$("#recordBtn").addClass("bg_gray");
$("#recordBtn").removeClass("bg_red");
// ロック画面の削除
delete_dom_obj("screenLock");
}
function recordTogle() {
if ($("#recordBtn").hasClass("bg_gray")) {
recordStart();
} else {
recordStop(function () {
console.log("レコードを終了しました");
});
}
}
function recordStop(callback) {
// アーカイブ保存中は画面操作不可(協業終了,協業切り替え防止)
screenLock();
// アーカイブ保存処理
MainManRecordWithCollaboration(
"stop",
CMS_SERVER_URL + "/chatapi/file/uploadArchive",
callback
);
}
function MainManRecordWithCollaboration(action, url, callback) {
mediaRecorder.stop();
console.log("Recorded Blobs: ", recordedBlobs);
setTimeout(function () {
console.log("Recoding File upload..");
const blob = new Blob(recordedBlobs, { type: "video/webm" });
console.log(blob);
var uploadFileName = "record_" + g_webroom + "_" + g_shareCount + ".webm";
g_shareCount++;
var formData = new FormData();
formData.append("fileData", blob, uploadFileName);
formData.append("sid", globalUserInfo.sid);
formData.append("roomId", globalUserInfo.roomId);
if (joinCollaborationType == COLLABORATION_TYPE.VIDEO) {
formData.append("archiveType", 1);
} else {
formData.append("archiveType", 2);
}
console.log(uploadFileName);
$.ajax({
type: "post",
url,
data: formData,
contentType: false,
processData: false,
success: function (res) {
recordFinished();
console.log(res);
callback();
},
error: function (err) {
recordFinished();
console.log(err);
callback();
},
});
}, 1000);
}
function screenLock() {
// ロック用のdivを生成
var element = document.createElement("div");
element.id = "screenLock";
// ロック用のスタイル
element.style.height = "100%";
element.style.left = "0px";
element.style.position = "fixed";
element.style.top = "0px";
element.style.width = "100%";
element.style.zIndex = "9999";
element.style.opacity = "0";
var objBody = document.getElementsByTagName("body").item(0);
objBody.appendChild(element);
}
// div削除関数
function delete_dom_obj(id_name) {
var dom_obj = document.getElementById(id_name);
var dom_obj_parent = dom_obj.parentNode;
dom_obj_parent.removeChild(dom_obj);
}
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