Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chat_webview
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abookCommunication
chat_webview
Commits
0c53021f
Commit
0c53021f
authored
May 24, 2021
by
Kang Donghun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
テストコミット
parent
bc873f6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
358 additions
and
65 deletions
+358
-65
public_new/js/share.js
+358
-65
No files found.
public_new/js/share.js
View file @
0c53021f
...
@@ -7,13 +7,14 @@ var isBoard = false;
...
@@ -7,13 +7,14 @@ var isBoard = false;
let
isLeaved
=
false
;
let
isLeaved
=
false
;
let
timeInterval
=
null
;
let
timeInterval
=
null
;
var
backgroundFileName
;
var
backgroundFileName
;
var
isIos
;
$
(
function
()
{
$
(
function
()
{
var
coviewApiActive
=
coview_api
.
Init
({
var
coviewApiActive
=
coview_api
.
Init
({
testSTRParam
:
"param1"
,
testSTRParam
:
"param1"
,
testNUMParam
:
77
,
testNUMParam
:
77
,
testBOOLParam
:
false
,
testBOOLParam
:
false
,
coview_api_srv_addr
:
"https://
live
taskyell.abookcloud.com"
,
coview_api_srv_addr
:
"https://
biz
taskyell.abookcloud.com"
,
coview_wrap_id
:
"coviewShare"
,
coview_wrap_id
:
"coviewShare"
,
coview_api_key
:
"8dda7092c5820d663"
,
coview_api_key
:
"8dda7092c5820d663"
,
});
});
...
@@ -118,6 +119,70 @@ $(function () {
...
@@ -118,6 +119,70 @@ $(function () {
console
.
log
(
"=============> READY : ready for coview api"
);
console
.
log
(
"=============> READY : ready for coview api"
);
Coview_addLoginId
(
globalUserInfo
.
loginId
);
Coview_addLoginId
(
globalUserInfo
.
loginId
);
coview_api
.
Login
(
globalUserInfo
.
loginId
);
coview_api
.
Login
(
globalUserInfo
.
loginId
);
initCollaborationUI
(
joinCollaborationType
)
fw
.
socket
.
on
(
'message'
,
async
function
(
data
)
{
console
.
log
(
'====> message::data: '
,
data
);
if
(
data
.
type
===
"CHANGE_COLLABORATION"
)
{
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
exitMeetingRoom
();
}
}
if
(
CHAT_UTIL
.
isAndroid
()
&&
data
.
payload
.
collaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
'not_support_version'
));
joinCollaborationType
=
COLLABORATION_TYPE
.
CAMERA
;
}
else
{
joinCollaborationType
=
data
.
payload
.
collaborationType
;
}
joinMeetingId
=
data
.
payload
.
newMeetingId
;
initCollaborationUI
(
joinCollaborationType
);
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
joinChangedCollaboration
.
postMessage
({
"joinCollaborationType"
:
joinCollaborationType
,
"meetingId"
:
data
.
payload
.
newMeetingId
});
webkit
.
messageHandlers
.
joinMeetingRoom
.
postMessage
(
data
.
payload
.
newMeetingId
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
joinChangedCollaboration
(
joinCollaborationType
,
data
.
payload
.
newMeetingId
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
android
.
joinMeetingRoom
(
data
.
payload
.
newMeetingId
);
}
}
}
else
if
(
data
.
type
===
"SHARE_FILE"
)
{
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
)
{
initCollaborationUI
(
COLLABORATION_TYPE
.
CAMERA
);
joinCollaborationType
=
COLLABORATION_TYPE
.
CAMERA
;
fw
.
sendToMsg
(
'others'
,
'SHARE_FILE_HOST'
,
{
"collaborationType"
:
COLLABORATION_TYPE
.
CAMERA
});
}
}
else
if
(
data
.
type
===
"SHARE_FILE_HOST"
)
{
if
(
joinCollaborationType
!=
COLLABORATION_TYPE
.
CAMERA
&&
g_isMainMan
)
{
initCollaborationUI
(
COLLABORATION_TYPE
.
CAMERA
);
joinCollaborationType
=
COLLABORATION_TYPE
.
CAMERA
;
}
}
else
if
(
data
.
type
===
"CAPTURE_REQUEST"
&&
g_isMainMan
)
{
if
(
confirm
(
data
.
payload
.
name
+
getLocalizedString
(
"request_capture"
)))
{
captureAndShareImage
(
CMS_SERVER_URL
+
'/chatapi/file/uploadArchive'
,
data
.
payload
.
name
);
}
}
else
if
(
data
.
type
===
"HOST_CHANGE_REQUEST"
)
{
if
(
data
.
payload
.
loginId
==
CHAT
.
globalLoginParameter
.
loginId
)
{
fw
.
sendToMsg
(
'others'
,
'HOST_CHANGE_RESPONSE'
,
{
"isAndroid"
:
CHAT_UTIL
.
isAndroid
(),
"isAble"
:
androidVersion
>=
ANDROID_SDK_VERSION
.
O
,
"loginId"
:
CHAT
.
globalLoginParameter
.
loginId
});
}
}
else
if
(
data
.
type
===
"HOST_CHANGE_RESPONSE"
)
{
var
isAndroid
=
data
.
payload
.
isAndroid
;
var
isAble
=
data
.
payload
.
isAble
if
(
g_isMainMan
&&
isAndroid
&&
!
isAble
&&
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
alert
(
getLocalizedString
(
'err_target_android_version_not_support'
));
}
else
{
Coview_changeHost
(
data
.
payload
.
loginId
);
}
}
else
if
(
data
.
type
===
"API_SEND_OWNER_CHANGE_COMPLETE"
)
{
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
recordStop
();
}
penOff
();
}
});
});
});
coview_api
.
addEventListener
(
"start"
,
function
()
{
coview_api
.
addEventListener
(
"start"
,
function
()
{
...
@@ -158,9 +223,6 @@ $(function () {
...
@@ -158,9 +223,6 @@ $(function () {
let
loginIdList
=
new
Array
();
let
loginIdList
=
new
Array
();
switch
(
json
.
api
)
{
switch
(
json
.
api
)
{
case
"LoginResponse"
:
case
"LoginResponse"
:
console
.
log
(
"------------------------------"
);
console
.
log
(
globalUserInfo
.
coWorkType
);
console
.
log
(
collaborationJoinFlg
);
if
(
globalUserInfo
.
coWorkType
==
collaborationTypeKey
.
DOCUMENT
)
{
if
(
globalUserInfo
.
coWorkType
==
collaborationTypeKey
.
DOCUMENT
)
{
isDocument
=
true
;
isDocument
=
true
;
globalUserInfo
.
coWorkType
=
collaborationTypeKey
.
AUDIO
;
globalUserInfo
.
coWorkType
=
collaborationTypeKey
.
AUDIO
;
...
@@ -169,11 +231,12 @@ $(function () {
...
@@ -169,11 +231,12 @@ $(function () {
isBoard
=
true
;
isBoard
=
true
;
globalUserInfo
.
coWorkType
=
collaborationTypeKey
.
CAMERA
;
globalUserInfo
.
coWorkType
=
collaborationTypeKey
.
CAMERA
;
}
}
hostSearchInterval
();
if
(
collaborationJoinFlg
==
"1"
)
{
if
(
collaborationJoinFlg
==
"1"
)
{
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
coview_api
.
JoinRoom
(
globalUserInfo
.
roomId
,
globalUserInfo
.
coWorkType
);
if
(
isDocument
)
{
if
(
isDocument
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
startContentView
.
postMessage
({});
webkit
.
messageHandlers
.
startContentView
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
startContentView
();
android
.
startContentView
();
}
}
...
@@ -213,7 +276,7 @@ $(function () {
...
@@ -213,7 +276,7 @@ $(function () {
messageSeperator
+
messageSeperator
+
messageType
.
COMMUNICATIONSTART
+
messageType
.
COMMUNICATIONSTART
+
messageSeperator
+
messageSeperator
+
collaborationType
.
BOARD
;
COLLABORATION_TYPE
.
BOARD
;
}
else
{
}
else
{
coviewInviteMessage
=
coviewInviteMessage
=
""
+
""
+
...
@@ -252,6 +315,7 @@ $(function () {
...
@@ -252,6 +315,7 @@ $(function () {
break
;
break
;
case
"JoinRoomResponse"
:
case
"JoinRoomResponse"
:
if
(
json
.
resultCode
==
200
)
{
if
(
json
.
resultCode
==
200
)
{
hostSearchInterval
();
for
(
let
key
in
g_participants
)
{
for
(
let
key
in
g_participants
)
{
loginIdList
.
push
(
key
);
loginIdList
.
push
(
key
);
}
}
...
@@ -310,30 +374,154 @@ function Coview_moveToVideoShareArea() {
...
@@ -310,30 +374,154 @@ function Coview_moveToVideoShareArea() {
$
(
"#collabo_main"
).
removeClass
(
"none"
);
$
(
"#collabo_main"
).
removeClass
(
"none"
);
}
}
function
changeCollaboration
(
changeCollaborationType
)
{
var
newMeetingId
=
0
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
exitMeetingRoom
();
}
}
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
setJoinCollaborationType
.
postMessage
(
changeCollaborationType
);
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
if
(
changeCollaborationType
==
COLLABORATION_TYPE
.
DOCUMENT
&&
androidVersion
<
ANDROID_SDK_VERSION
.
O
)
{
alert
(
getLocalizedString
(
'not_support_version'
));
return
;
}
android
.
setJoinCollaborationType
(
changeCollaborationType
);
}
joinCollaborationType
=
changeCollaborationType
;
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
recordStop
();
}
initCollaborationUI
(
changeCollaborationType
);
switch
(
changeCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
coview_api
.
ChangeCollaboration
(
'audio'
);
break
;
case
COLLABORATION_TYPE
.
CAMERA
:
coview_api
.
ChangeCollaboration
(
'image'
);
break
;
case
COLLABORATION_TYPE
.
VIDEO
:
coview_api
.
ChangeCollaboration
(
'video'
);
break
;
case
COLLABORATION_TYPE
.
DOCUMENT
:
coview_api
.
ChangeCollaboration
(
'audio'
);
if
(
CHAT_UTIL
.
isIOS
())
{
newMeetingId
=
CHAT_DB
.
createContentView
();
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
newMeetingId
=
android
.
createContentView
();
console
.
log
(
'newMeetingId = '
+
newMeetingId
);
}
break
;
case
COLLABORATION_TYPE
.
BOARD
:
coview_api
.
ChangeCollaboration
(
'audio'
);
break
;
}
penOff
();
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
changeCollaboration
.
postMessage
({
"changeCollaborationType"
:
changeCollaborationType
,
"meetingId"
:
newMeetingId
});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
changeCollaboration
(
changeCollaborationType
,
newMeetingId
);
}
fw
.
sendToMsg
(
'others'
,
'CHANGE_COLLABORATION'
,
{
"collaborationType"
:
changeCollaborationType
,
"newMeetingId"
:
newMeetingId
});
}
function
initCollaborationUI
(
changeCollaborationType
){
if
(
$
(
'.user_btn'
).
hasClass
(
"hide"
))
{
$
(
'.user_btn'
).
click
();
}
if
(
$
(
'.menu_btn'
).
hasClass
(
"hide"
))
{
$
(
".menu_btn"
).
click
();
}
$
(
"link[href='./css/collaboration_board.css']"
).
remove
();
penOff
();
switch
(
changeCollaborationType
)
{
case
COLLABORATION_TYPE
.
AUDIO
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.voice_contents'
).
removeClass
(
'none'
);
var
w
=
$
(
'.user_btn'
).
width
();
$
(
'.user_btn'
).
toggleClass
(
"hide"
);
$
(
"#overlay_user_list.overlay"
)
.
toggleClass
(
"slidein"
)
.
css
({
transform
:
"translateX("
&
-
w
&
")"
});
$
(
"#collabo_main"
).
toggleClass
(
"noscroll"
);
if
(
$
(
"#overlay_user_list.overlay"
).
hasClass
(
"noscroll"
))
{
$
(
"#overlay_user_list.overlay"
).
removeClass
(
"noscroll"
);
}
else
{
$
(
"#overlay_user_list.overlay"
).
addClass
(
"noscroll"
);
}
break
;
case
COLLABORATION_TYPE
.
CAMERA
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.picture_contents'
).
removeClass
(
'none'
);
break
;
case
COLLABORATION_TYPE
.
VIDEO
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.video_contents'
).
removeClass
(
'none'
);
break
;
case
COLLABORATION_TYPE
.
DOCUMENT
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.document_contents'
).
removeClass
(
'none'
);
var
w
=
$
(
'.user_btn'
).
width
();
$
(
'.user_btn'
).
toggleClass
(
"hide"
);
$
(
"#overlay_user_list.overlay"
)
.
toggleClass
(
"slidein"
)
.
css
({
transform
:
"translateX("
&
-
w
&
")"
});
$
(
"#collabo_main"
).
toggleClass
(
"noscroll"
);
if
(
$
(
"#overlay_user_list.overlay"
).
hasClass
(
"noscroll"
))
{
$
(
"#overlay_user_list.overlay"
).
removeClass
(
"noscroll"
);
}
else
{
$
(
"#overlay_user_list.overlay"
).
addClass
(
"noscroll"
);
}
break
;
case
COLLABORATION_TYPE
.
BOARD
:
$
(
'.collaboration_contents'
).
addClass
(
'none'
);
$
(
'.board_contents'
).
removeClass
(
'none'
);
$
(
'head'
).
append
(
'<link rel="stylesheet" href="./css/collaboration_board.css">'
);
break
;
}
}
function
Coview_exitCollaboration
(
isDocument
=
false
)
{
function
Coview_exitCollaboration
(
isDocument
=
false
)
{
if
(
isDocument
)
{
if
(
isDocument
)
{
if
(
CHAT_UTIL
.
isIOS
())
{
if
(
CHAT_UTIL
.
isIOS
())
{
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
webkit
.
messageHandlers
.
exitMeetingRoom
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
exitMeetingRoom
();
android
.
exitMeetingRoom
();
}
}
}
clearInterval
(
timeInterval
);
}
coview_api
.
LeaveRoom
();
if
(
$
(
'#recordBtn'
).
hasClass
(
'bg_red'
))
{
if
(
coview_api
.
getRoomUsers
())
{
android
.
finishCollaboration
()
};
recordStop
();
isLeaved
=
true
;
}
if
(
collaborationJoinFlg
!=
'2'
)
{
clearInterval
(
timeInterval
);
CHAT_UI
.
joinRoom
(
coview_api
.
LeaveRoom
();
CHAT
.
globalLoginParameter
.
roomId
,
if
(
coview_api
.
getRoomUsers
())
{
CHAT
.
globalLoginParameter
.
name
if
(
CHAT_UTIL
.
isIOS
())
{
);
webkit
.
messageHandlers
.
finishCollaboration
.
postMessage
({});
}
else
if
(
CHAT_UTIL
.
isAndroid
())
{
android
.
finishCollaboration
()
}
};
isLeaved
=
true
;
if
(
collaborationJoinFlg
!=
'2'
)
{
CHAT_UI
.
joinRoom
(
CHAT
.
globalLoginParameter
.
roomId
,
CHAT
.
globalLoginParameter
.
name
);
}
else
{
if
(
typeof
android
!=
"undefined"
)
{
android
.
openCommunicationHome
();
}
else
{
}
else
{
if
(
typeof
android
!=
"undefined"
)
{
webkit
.
messageHandlers
.
openCommunicationHome
.
postMessage
({});
android
.
openCommunicationHome
();
}
else
{
webkit
.
messageHandlers
.
openCommunicationHome
.
postMessage
({});
}
}
}
}
}
}
function
Coview_changeHost
(
userId
)
{
function
Coview_changeHost
(
userId
)
{
...
@@ -342,24 +530,24 @@ function Coview_changeHost(userId) {
...
@@ -342,24 +530,24 @@ function Coview_changeHost(userId) {
}
}
function
Coview_addLoginId
(
loginId
)
{
function
Coview_addLoginId
(
loginId
)
{
console
.
log
(
"addUser loginId = "
+
loginId
);
console
.
log
(
"addUser loginId = "
+
loginId
);
var
url
=
"https://live
taskyell.abookcloud.com/auth/getuser"
;
var
url
=
"https://biz
taskyell.abookcloud.com/auth/getuser"
;
$
.
ajax
({
$
.
ajax
({
url
:
url
,
url
:
url
,
method
:
'post'
,
method
:
'post'
,
data
:
{
data
:
{
id
:
loginId
id
:
loginId
},
},
success
:
function
(
result
)
{
success
:
function
(
result
)
{
console
.
log
(
"result"
,
result
);
console
.
log
(
"result"
,
result
);
if
(
result
.
statusCode
!=
200
)
{
if
(
result
.
statusCode
!=
200
)
{
coview_api
.
addUser
(
loginId
);
coview_api
.
addUser
(
loginId
);
}
}
},
},
error
:
function
(
err
)
{
error
:
function
(
err
)
{
console
.
log
(
err
.
toString
());
console
.
log
(
err
.
toString
());
}
}
});
});
}
}
function
Coview_connect_audio_collaboration
()
{
function
Coview_connect_audio_collaboration
()
{
...
@@ -371,31 +559,137 @@ function Coview_connect_audio_collaboration() {
...
@@ -371,31 +559,137 @@ function Coview_connect_audio_collaboration() {
}
}
function
hostSearchInterval
()
{
function
hostSearchInterval
()
{
let
hostName
=
""
;
let
hostName
=
""
;
function
hostSearch
()
{
function
hostSearch
()
{
if
(
hostName
!=
g_isMainManUsername
)
{
if
(
g_isMainMan
)
{
if
(
hostName
!=
""
)
{
$
(
'.host_contents'
).
removeClass
(
'none'
);
$
(
"#collaboration_user_"
+
hostName
).
removeClass
(
"host"
);
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
}
$
(
'.photo_select_button'
).
removeClass
(
'none'
);
$
(
"#collaboration_user_"
+
g_isMainManUsername
).
addClass
(
"host"
);
}
hostName
=
g_isMainManUsername
;
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
}
else
{
$
(
'.video_contents_host'
).
removeClass
(
'none'
);
if
(
hostName
==
""
)
{
$
(
'.video_contents_user'
).
addClass
(
'none'
);
if
(
!
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
hasClass
(
"host"
)
&&
coview_api
.
getRoomUsers
())
{
}
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
addClass
(
"host"
);
if
(
CHAT_UTIL
.
isIOS
())
isIos
=
true
;
}
}
else
{
}
else
{
$
(
'.host_contents'
).
addClass
(
'none'
);
if
(
!
$
(
"#collaboration_user_"
+
hostName
).
hasClass
(
'host'
))
{
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
CAMERA
)
{
$
(
"#collaboration_user_"
+
hostName
).
addClass
(
"host"
);
$
(
'.photo_select_button'
).
addClass
(
'none'
);
}
}
}
if
(
joinCollaborationType
==
COLLABORATION_TYPE
.
VIDEO
)
{
$
(
'.video_contents_user'
).
removeClass
(
'none'
);
$
(
'.video_contents_host'
).
addClass
(
'none'
);
}
}
if
(
hostName
!=
g_isMainManUsername
)
{
if
(
hostName
!=
""
)
{
$
(
"#collaboration_user_"
+
hostName
).
removeClass
(
"host"
);
}
$
(
"#collaboration_user_"
+
g_isMainManUsername
).
addClass
(
"host"
);
hostName
=
g_isMainManUsername
;
}
else
{
if
(
hostName
==
""
)
{
if
(
!
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
hasClass
(
"host"
)
&&
coview_api
.
getRoomUsers
())
{
$
(
"#collaboration_user_"
+
CHAT
.
globalLoginParameter
.
loginId
).
addClass
(
"host"
);
}
}
}
else
{
if
(
!
$
(
"#collaboration_user_"
+
hostName
).
hasClass
(
'host'
))
{
$
(
"#collaboration_user_"
+
hostName
).
addClass
(
"host"
);
}
}
}
}
timeInterval
=
setInterval
(
hostSearch
,
2000
);
}
function
hostChangeRequest
(
loginId
)
{
fw
.
sendToMsg
(
'others'
,
'HOST_CHANGE_REQUEST'
,
{
"loginId"
:
loginId
});
}
function
captureAndShareImage
(
urls
,
changeHostName
)
{
addCaptureEffect
();
$
(
this
).
removeClass
(
"on"
);
var
w
,
h
;
var
video
=
document
.
getElementById
(
"localVideo"
);
var
canvas
=
document
.
createElement
(
'canvas'
);
if
(
clientOrientaionState
==
1
)
{
canvas
.
width
=
w
=
680
;
canvas
.
height
=
h
=
515
;
}
else
{
canvas
.
width
=
w
=
386
;
canvas
.
height
=
h
=
515
;
}
if
(
canvas
.
getContext
)
{
var
ctx
=
canvas
.
getContext
(
'2d'
);
ctx
.
drawImage
(
video
,
0
,
0
,
w
,
h
);
ctx
.
drawImage
(
document
.
getElementById
(
"canvasRemote"
),
0
,
0
,
w
,
h
);
}
canvas
.
toBlob
(
function
(
blob
)
{
var
newImg
=
document
.
createElement
(
'img'
)
var
url
=
URL
.
createObjectURL
(
blob
);
canvasRemote
.
style
.
backgroundImage
=
"url('"
+
URL
.
createObjectURL
(
blob
)
+
"')"
;
canvasRemote
.
style
.
backgroundSize
=
"contain"
;
$
(
canvasRemote
).
attr
(
"height"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"height"
));
$
(
canvasRemote
).
attr
(
"width"
,
$
(
snapshots
[
cpatureViewIndex
]).
attr
(
"width"
));
console
.
log
(
'url'
,
URL
.
createObjectURL
(
blob
));
if
(
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
/
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
<
$
(
canvas
).
attr
(
"width"
)
/
$
(
canvas
).
attr
(
"height"
))
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
)
*
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
var
w
=
$
(
".canvas_wrap"
).
css
(
"width"
).
replace
(
"px"
,
""
);
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
(
-
h
/
2
));
$
(
canvasRemote
).
css
(
"margin-left"
,
(
-
w
/
2
));
}
else
{
var
h
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
);
var
w
=
$
(
".canvas_wrap"
).
css
(
"height"
).
replace
(
"px"
,
""
)
/
(
$
(
canvas
).
attr
(
"height"
)
/
$
(
canvas
).
attr
(
"width"
));
$
(
canvasRemote
).
css
(
"height"
,
h
);
$
(
canvasRemote
).
css
(
"width"
,
w
);
$
(
canvasRemote
).
css
(
"margin-top"
,
(
-
h
/
2
));
$
(
canvasRemote
).
css
(
"margin-left"
,
(
-
w
/
2
));
}
}
timeInterval
=
setInterval
(
hostSearch
,
2000
);
$
(
".canvas_wrap"
).
css
(
"background-color"
,
"#000"
);
$
(
".clear_img"
).
show
();
SetShareMenuState
(
"on"
);
WithImageShareBtnState
(
"on"
);
//Fermi側にイメージ保存。
var
formData
=
new
FormData
();
var
uploadFileName
=
"capture_share_"
+
g_webroom
+
"_"
+
g_shareCount
+
".png"
g_shareCount
++
;
formData
.
append
(
"imgFile"
,
blob
,
uploadFileName
);
var
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
":"
+
location
.
port
+
"/upload/create"
;
if
(
!
location
.
port
)
{
uploadUrl
=
location
.
protocol
+
"//"
+
location
.
hostname
+
"/upload/create"
;
}
$
.
ajax
({
type
:
'post'
,
url
:
g_coviewapiserverADDR
+
"/upload/create"
,
data
:
formData
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
res
)
{
setTimeout
(
function
()
{
SendFileShare
(
uploadFileName
);
$
(
"#coviewCaptureCtrBtn"
).
hide
();
$
(
"#coviewRecCtrBtn"
).
hide
();
$
(
".coview_share_title_name"
).
text
(
"LIVE(CAPTURE IMAGE)"
);
$
(
".coview_on_media_btn_back"
).
show
();
//アーカイブ保存。
ArchiveFileManage
(
blob
,
uploadFileName
,
urls
);
},
1500
);
},
error
:
function
(
err
)
{
console
.
log
(
err
);
}
});
});
}
}
function
applyForHostChange
()
{
function
applyForHostChange
()
{
// coview_api.addEventProcess({"api": "HostRequest", "hostId": CHAT.globalLoginParameter.loginId});
// coview_api.addEventProcess({"api": "HostRequest", "hostId": CHAT.globalLoginParameter.loginId});
wc_api
.
dispatchEvent
(
new
Event
(
"message"
),
{
"api"
:
"HostRequest"
,
"hostId"
:
CHAT
.
globalLoginParameter
.
loginId
});
wc_api
.
dispatchEvent
(
new
Event
(
"message"
),
{
"api"
:
"HostRequest"
,
"hostId"
:
CHAT
.
globalLoginParameter
.
loginId
});
// fw.sendToMsg('others', 'CHANGE_HOST_APPLY', {"hostId": CHAT.globalLoginParameter.loginId});
// fw.sendToMsg('others', 'CHANGE_HOST_APPLY', {"hostId": CHAT.globalLoginParameter.loginId});
};
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment