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();
}
......
......@@ -445,66 +445,13 @@ CHAT_UI.showConfirmView = function (isInvite) {
//const encodedRoomName = encodeURIComponent(newRoomName);
//todo android create room api
if (typeof android != "undefined") {
android.createChatRoom(
"1",
userIdList.join(","),
newRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": "1",
"userIdList": userIdList.join(","),
"roomName": newRoomName,
"screenFlg": MakeRoomFlag.MAKE_ROOM,
"isVoice": false,
});
}
/*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, newRoomName, function() {
CHAT.saveRoomInfo(newRoomId, newRoomName);
$('#messages').html('');
$('.titleRoomName').text(newRoomName).data('roomName', newRoomName);
$("#userSelectionDeleteBtn").hide();
$('#pills-chat-tab').tab('show');
});
});*/
/*socket.on('createNewRoom', (shopMemberIdList, newRoomName, callback) => {
const user = onlineUsers.getUser(socket.id)
if(user) {
var loginIdListObj = new Object();
var newRoomNameObj = new Object();
loginIdListObj.type = 'loginIdList'
loginIdListObj.value = shopMemberIdList
newRoomNameObj.type = 'newRoomName'
newRoomNameObj.value = newRoomName
var path = httpRequest.makeChatRoomManageUrlPath(user.shopName, constant.ROOM_CREATENEWROOM, user.sid, loginIdListObj, newRoomNameObj)
winston.info('path' + path)
httpRequest.readResult(path, (res) =>{
const error = serverErrorHandler(res)
if(error.errorFlag) {
winston.error("Failed to [createNewRoom] process.")
socket.emit("showServerError", error.errorMessage);
return;
}
winston.info('create new room from server '+ util.inspect(res, false, null, false))
callback(res.roomId)
// ユーザーリストをアップデートする
socket.emit(res.roomId).emit('updateUserList', res.userList, [user.shop_member_id])
})
} else {
socket.emit("retryJoinProcess")
//join process
}
})*/
createChatRoom(
ChatRoomType.DM,
userIdList,
newRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else if (
trimmedRoomName.includes(";") ||
trimmedRoomName.includes("/") ||
......@@ -574,23 +521,13 @@ CHAT_UI.showConfirmView = function (isInvite) {
// ルーム名のtrimmingした後、URIencodingを行う
const encodedRoomName = encodeURIComponent(trimmedRoomName);
if (typeof android != "undefined") {
android.createChatRoom(
"1",
userIdList.join(","),
encodedRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": "1",
"userIdList": userIdList.join(","),
"roomName": newRoomName,
"screenFlg": MakeRoomFlag.MAKE_ROOM,
"isVoice": false,
});
}
createChatRoom(
ChatRoomType.DM,
userIdList,
encodedRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
}
}
}
......@@ -878,20 +815,7 @@ CHAT_UI.refreshContactScreen = function () {
var myNamecardTemplate = getTemplate(TemplateURL.MY_NAME_CARD);
var groupUserTemplate = getTemplate(TemplateURL.GROUP_USER_LIST);
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo("0");
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
} else {
webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
}
}
updateContactInfo();
var myInfo = CHAT_DB.getMyInfo();
myInfo.profileImagePath = CHAT.getProfileImgUrl(myInfo.profileUrl);
......@@ -1428,13 +1352,7 @@ CHAT_UI.refreshAllGroupSearch = function (paramGroupId) {
$("#tabAllGroup").prop("checked", true);
//オンライン状態であればサーバから情報更新。
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo(groupId);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage(groupId);
}
}
updateGroupInfo(groupId);
//画面エリアを初期化。
$("#rootGroupBtn").off();
......@@ -1512,23 +1430,13 @@ CHAT_UI.startChat = function (userShopMemberId, userName) {
// 参加ユーザ名でルーム名を生成
let newRoomName = CHAT.globalLoginParameter.loginId + "," + userName;
if (typeof android != "undefined") {
android.createChatRoom(
ChatRoomType.DM,
userIdList.join(","),
newRoomName,
MakeRoomFlag.NAME_CARD,
false
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": "1",
"userIdList": userIdList.join(","),
"roomName": newRoomName,
"screenFlg": MakeRoomFlag.NAME_CARD,
"isVoice": false,
});
}
createChatRoom(
ChatRoomType.DM,
userIdList,
newRoomName,
MakeRoomFlag.NAME_CARD,
false
);
};
CHAT_UI.startVoice = function (userShopMemberId, userName) {
......@@ -1538,24 +1446,13 @@ CHAT_UI.startVoice = function (userShopMemberId, userName) {
// 参加ユーザ名でルーム名を生成
let newRoomName = CHAT.globalLoginParameter.loginId + "," + userName;
if (typeof android != "undefined") {
android.createChatRoom(
ChatRoomType.DM,
userIdList.join(","),
newRoomName,
MakeRoomFlag.NAME_CARD,
true
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": "1",
"userIdList": userIdList.join(","),
"roomName": newRoomName,
"screenFlg": MakeRoomFlag.NAME_CARD,
"isVoice": true,
});
}
CHAT_UI.startCollaboration(COLLABORATION_TYPE.AUDIO);
createChatRoom(
ChatRoomType.DM,
userIdList,
newRoomName,
MakeRoomFlag.NAME_CARD,
true
);
};
CHAT_UI.makeNameCard = function (shopMemberId) {
......@@ -1592,55 +1489,129 @@ CHAT_UI.toggleCategory = function (category) {
};
// アーカイブ一覧
CHAT_UI.refreshArchiveScreen = function () {
CHAT_UI.refreshArchiveDetailScreen = function (archiveId) {
// loadingIndicatorを表示
CHAT_UI.showLoadingIndicator();
// 初期化
$("#archiveList").html("");
$("#archiveDetail").html("");
// アーカイブ詳細の様式を読み込む
const archiveDetailTemplate = $("#archive-detail-template").html();
if (IS_ONLINE == "true") {
CHAT_DB.updateArchiveDetail(archiveId);
}
// アーカイブの様式を読み込む
const archiveTemplate = $("#archive-template").html();
// アーカイブ詳細取得
var archive = CHAT_DB.getArchiveDetail(archiveId);
// アーカイブ一覧取得
if (IS_ONLINE == "true") {
CHAT_DB.updateArchiveList();
// チャットルーム情報を取得
var roomId = archive.roomId;
//保存ユーザ情報を取得
var userInfo = CHAT_DB.getUserInfo(archive.saveUserId);
userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl);
// アーカイブ情報を表示
var html = Mustache.render(archiveDetailTemplate, {
fileName: archive.archiveName,
insertDate: archive.archiveDate,
chatRoomName: archive.roomName,
chatRoomId: archive.roomId,
profileImage: userInfo.profileUrl,
userName: userInfo.shopMemberName,
userId: userInfo.shopMemberId,
});
var obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#archiveDetail").append(obj);
// プレイヤーの切り替え
var archiveFilePath = CHAT.createGetDataUrl(archive.filePath, archive.roomId);
switch (archive.archiveType) {
case "0": // 画像
case 0:
$("#archive_player").prepend(
'<img class="archive_player" src="' + archiveFilePath + '" />'
);
break;
case "1": // 動画
case 1:
if (CHAT_UTIL.isIOS()) {
$("#archive_player").prepend(
'<video class="archive_player" controls autoplay muted playsinline controlsList="nodownload"><source src="' +
archiveFilePath +
'" type="video/mp4"><source src="' +
archiveFilePath +
'" type="video/ogv"><source src="' +
archiveFilePath +
'" type="video/webm"></video>'
);
} else {
$("#archive_player").prepend(
'<video class="archive_player" src=' +
archiveFilePath +
' controls autoplay muted playsinline controlsList="nodownload"></video>'
);
}
break;
case "2": // 音声
case 2:
if (CHAT_UTIL.isIOS()) {
$("#archive_player").prepend(
'<audio id="mv" class="archive_audio_player" controls controlsList="nodownload"><source src="' +
archiveFilePath +
'" type="audio/wav"><source src="' +
archiveFilePath +
'" type="audio/ogg"></audio>'
);
} else {
$("#archive_player").prepend(
'<audio class="archive_audio_player" src=' +
archiveFilePath +
' controls controlsList="nodownload"></audio>'
);
}
$("#archive_player").prepend(
'<img class="archive_player" src=' + "./img/capture.png" + " />"
);
break;
case "3": // 文書
case 3:
// リリースに文書とその他は含めないため今回は非表示
break;
default:
// リリースに文書とその他は含めないため今回は非表示
}
// ローカルDBのデータを表示
var archiveList = CHAT_DB.getArchiveList();
if (typeof archiveList == "undefined") {
CHAT_UI.dismissLoadingIndicator();
return;
// ユーザの様式を読み込む
const archiveUserTemplate = $("#archive-user-template").html();
// 参加ユーザ情報を表示
let attendUserList = archive.attendUserIds;
if (typeof android != "undefined") {
// ios実装不要
attendUserList = JSON.parse(archive.attendUserIds);
}
archiveList.forEach(function (archive) {
var typeImage = "";
switch (archive.archiveType) {
case 0: // 画像
typeImage = "icon/icon_collabo_picture.png";
break;
case 1: // 動画
typeImage = "icon/icon_collabo_videocam.png";
break;
case 2: // 音声
typeImage = "icon/icon_collabo_headset.png";
break;
case 3: // 文書
typeImage = "icon/icon_collabo_document.png";
break;
default:
// その他
typeImage = "";
}
let html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId,
fileName: archive.archiveName,
insertDate: archive.archiveDate,
typeImage: typeImage,
attendUserList.forEach(function (user) {
var userInfo = CHAT_DB.getUserInfo(user);
userInfo.profileUrl = CHAT.getProfileImgUrl(userInfo.profileUrl);
var html = Mustache.render(archiveUserTemplate, {
profileImage: userInfo.profileUrl,
userName: userInfo.shopMemberName,
});
let obj = $(jQuery.parseHTML(html)).on("click", function () {});
$("#archiveList").append(obj);
var obj = $(jQuery.parseHTML(html)).on("click", function () {
// ネームカード表示
CHAT_UI.makeNameCard(user);
});
$("#attendUser").append(obj);
});
CHAT_UI.htmlElementTextInitialize(navigator.language);
// チャットルームへのリンク付け
document.getElementById("joinChatRoom").onclick = function () {
CHAT_UI.joinRoom(archive.roomId, archive.roomName);
};
// loadingIndicatorを非表示
CHAT_UI.dismissLoadingIndicator();
......@@ -1797,19 +1768,7 @@ CHAT_UI.refreshMyGroupForMakeRoom = function () {
var groupUserTemplate = getTemplate(TemplateURL.MAKE_ROOM_GROUP_USER_LIST);
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo("0");
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
} else {
webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
}
}
updateContactInfo();
//お気に入りグループ取得。
var favoriteGroupList = CHAT_DB.getFavoriteGroups();
......@@ -1887,13 +1846,7 @@ CHAT_UI.refreshAllGroupForMakeRoom = function (paramGroupId) {
$("#tabAllGroupOnMakeRoom").prop("checked", true);
//オンライン状態であればサーバから情報更新。
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo(groupId);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage(groupId);
}
}
updateGroupInfo(groupId);
//画面エリアを初期化。
$("#parentGroupBtnForMakeRoom").off();
......@@ -2040,23 +1993,13 @@ CHAT_UI.showMakeRoomConfirmView = function () {
// 参加ユーザ名でルーム名を生成
let newRoomName =
CHAT.globalLoginParameter.loginId + "," + userNameList.join(",");
if (typeof android != "undefined") {
android.createChatRoom(
"1",
userIdList.join(","),
newRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": "1",
"userIdList": userIdList.join(","),
"roomName": newRoomName,
"screenFlg": MakeRoomFlag.MAKE_ROOM,
"isVoice": false,
});
}
createChatRoom(
ChatRoomType.DM,
userIdList,
newRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else if (
trimmedRoomName.includes(";") ||
trimmedRoomName.includes("/") ||
......@@ -2122,25 +2065,16 @@ CHAT_UI.showMakeRoomConfirmView = function () {
userIdList.push(user.shopMemberId);
});
// TODO: check why here using trimmedroomname instead of encodedRoomName
// ルーム名のtrimmingした後、URIencodingを行う
const encodedRoomName = encodeURIComponent(trimmedRoomName);
if (typeof android != "undefined") {
android.createChatRoom(
"1",
userIdList.join(","),
trimmedRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": "1",
"userIdList": userIdList.join(","),
"roomName": trimmedRoomName,
"screenFlg": MakeRoomFlag.MAKE_ROOM,
"isVoice": false,
});
}
createChatRoom(
ChatRoomType.DM,
userIdList,
trimmedRoomName,
MakeRoomFlag.MAKE_ROOM,
false
);
}
});
};
......@@ -2194,19 +2128,7 @@ CHAT_UI.refreshMyGroupForAddUser = function () {
var userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST);
var groupUserTemplate = getTemplate(TemplateURL.ADD_USER_GROUP_USER_LIST);
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo("0");
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
} else {
webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
}
}
updateContactInfo();
//お気に入りグループ取得。
var favoriteGroupList = CHAT_DB.getFavoriteGroups();
......@@ -2269,13 +2191,7 @@ CHAT_UI.refreshAllGroupForAddUser = function (paramGroupId) {
$("#tabAllGroupOnAddUser").prop("checked", true);
//オンライン状態であればサーバから情報更新。
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo(groupId);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage(groupId);
}
}
updateGroupInfo(groupId);
//画面エリアを初期化。
$("#parentGroupBtnForAddUser").off();
......@@ -2337,7 +2253,7 @@ CHAT_UI.refreshAllGroupForAddUser = function (paramGroupId) {
});
//該当グループの所属ユーザを表示。
var userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST);
const userTemplate = getTemplate(TemplateURL.ADD_USER_USER_LIST);
result.groupUserList.forEach(function (groupUser) {
groupUser.profileUrl = CHAT.getProfileImgUrl(groupUser.profileUrl);
let findObj = CHAT.globalSelectedUserList.find(function (shopMemberId) {
......@@ -2426,3 +2342,56 @@ CHAT_UI.displayExistRoom = function (roomId) {
}
return;
};
var createChatRoom = function (
chatRoomType,
userIDList,
newRoomName,
screenFlag,
isVoice
) {
//todo android create room api
if (typeof android != "undefined") {
android.createChatRoom(
chatRoomType,
userIDList.join(","),
newRoomName,
screenFlag,
isVoice
);
} else {
webkit.messageHandlers.createChatRoom.postMessage({
"roomType": chatRoomType,
"userIdList": userIDList.join(","),
"roomName": newRoomName,
"screenFlg": screenFlag,
"isVoice": isVoice,
});
}
};
var updateContactInfo = function () {
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo("0");
android.updateMyInfo();
android.updateGroupUser();
android.updateFavorite();
} else {
webkit.messageHandlers.updateGroupInfo.postMessage("0");
webkit.messageHandlers.updateMyInfo.postMessage({});
webkit.messageHandlers.updateGroupUser.postMessage({});
webkit.messageHandlers.updateFavorite.postMessage({});
}
}
};
var updateGroupInfo = function (groupID) {
if (IS_ONLINE == "true") {
if (typeof android != "undefined") {
android.updateGroupInfo(groupID);
} else {
webkit.messageHandlers.updateGroupInfo.postMessage(groupID);
}
}
}
\ No newline at end of file
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