hh-doctor-sdk 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/apis/video-message-api.js +18 -2
- package/components/public/behaviors/order-base-behaviors.js +1 -0
- package/components/video-chat/agora-rtc/agora-player/agora-player.js +1 -1
- package/components/video-chat/agora-rtc/agora-player/agora-player.wxml +1 -1
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.js +5 -1
- package/components/video-chat/agora-rtc/agora-pusher/agora-pusher.wxml +4 -1
- package/components/video-chat/agora-rtc/agora-rtc.js +5 -1
- package/components/video-chat/agora-rtc/agora-rtc.wxml +4 -3
- package/components/video-chat/controller/controller.js +1 -1
- package/components/video-chat/controller/controller.wxml +1 -1
- package/components/video-chat/remote-player/remote-player.js +1 -1
- package/components/video-chat/remote-player/remote-player.wxml +1 -1
- package/components/video-chat/video-chat.js +14 -4
- package/components/video-chat/video-chat.wxml +3 -3
- package/components/video-chat-page/behaviors/video-chat-behaviors.js +23 -16
- package/components/video-chat-page/video-chat-page.js +11 -11
- package/components/video-chat-page/video-chat-page.wxml +3 -3
- package/package.json +1 -1
|
@@ -19,6 +19,8 @@ const commands = {
|
|
|
19
19
|
INTERRUPT: "interrupt",
|
|
20
20
|
SWITCH_TO_AUDIO: "SWITCH_TO_AUDIO",
|
|
21
21
|
SWITCH_TO_VIDEO: "SWITCH_TO_VIDEO",
|
|
22
|
+
SWITCH_TO_VIDEO_SYNC: "SWITCH_TO_VIDEO_SYNC",
|
|
23
|
+
SWITCH_TO_AUDIO_SYNC: "SWITCH_TO_AUDIO_SYNC",
|
|
22
24
|
SWITCH_TO_VIDEO_WMP: "SWITCH_TO_VIDEO_SYNC_wmp",
|
|
23
25
|
SWITCH_TO_AUDIO_WMP: "SWITCH_TO_AUDIO_SYNC_wmp",
|
|
24
26
|
SWITCH_TO_AUDIO_SYNC_agora: "SWITCH_TO_AUDIO_SYNC_agora",
|
|
@@ -48,11 +50,25 @@ function sendReject() {
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
function sendSwitch2Audio(fromAgroa) {
|
|
51
|
-
|
|
53
|
+
if (fromAgroa) {
|
|
54
|
+
_sendMessage(commands.SWITCH_TO_AUDIO_SYNC_agora)
|
|
55
|
+
} else {
|
|
56
|
+
_sendMessage(commands.SWITCH_TO_AUDIO)
|
|
57
|
+
_sendMessage(commands.SWITCH_TO_AUDIO_SYNC)
|
|
58
|
+
_sendMessage(commands.SWITCH_TO_AUDIO_WMP)
|
|
59
|
+
}
|
|
60
|
+
|
|
52
61
|
}
|
|
53
62
|
|
|
54
63
|
function sendSwitch2Video(fromAgroa) {
|
|
55
|
-
|
|
64
|
+
if (fromAgroa) {
|
|
65
|
+
_sendMessage(commands.SWITCH_TO_VIDEO_SYNC_agora)
|
|
66
|
+
} else {
|
|
67
|
+
_sendMessage(commands.SWITCH_TO_VIDEO)
|
|
68
|
+
_sendMessage(commands.SWITCH_TO_VIDEO_SYNC)
|
|
69
|
+
_sendMessage(commands.SWITCH_TO_VIDEO_WMP)
|
|
70
|
+
}
|
|
71
|
+
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
function _sendMessage(command) {
|
|
@@ -29,6 +29,7 @@ module.exports = Behavior({
|
|
|
29
29
|
wx.statLog.sendStatLog(null, '获取订单详情数据完成')
|
|
30
30
|
// wx.hideLoading()
|
|
31
31
|
const order = res.data.order
|
|
32
|
+
// console.error(`order info ==> ${JSON.stringify(order)}`)
|
|
32
33
|
const feedbackStar = res.data.feedbackStar
|
|
33
34
|
let notifySetVideoTime = false
|
|
34
35
|
if (order && order.orderService && order.orderService.provideType === 'video') {
|
|
@@ -17,13 +17,17 @@ Component({
|
|
|
17
17
|
type: Number,
|
|
18
18
|
value: 0
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
selfInVoice: {
|
|
21
21
|
type: Boolean,
|
|
22
22
|
value: false
|
|
23
23
|
},
|
|
24
24
|
expertAvatar: {
|
|
25
25
|
type: String,
|
|
26
26
|
value: ''
|
|
27
|
+
},
|
|
28
|
+
selfInVoice: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
value: false
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
enable-camera="{{true}}"
|
|
17
17
|
bindstatechange="recorderStateChange"
|
|
18
18
|
/>
|
|
19
|
-
<view
|
|
19
|
+
<view
|
|
20
|
+
wx:if="{{selfInVoice || selfInVoice}}"
|
|
21
|
+
class="cover-view position-absolute small"
|
|
22
|
+
>
|
|
20
23
|
<image class="pusher-cover-image" src="{{expertAvatar}}" />
|
|
21
24
|
</view>
|
|
22
25
|
</view>
|
|
@@ -25,7 +25,7 @@ Component({
|
|
|
25
25
|
type: Number,
|
|
26
26
|
value: 0
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
selfInVoice: {
|
|
29
29
|
type: Boolean,
|
|
30
30
|
value: false
|
|
31
31
|
},
|
|
@@ -33,6 +33,10 @@ Component({
|
|
|
33
33
|
type: String,
|
|
34
34
|
value: ''
|
|
35
35
|
},
|
|
36
|
+
selfInVoice: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
value: false
|
|
39
|
+
}
|
|
36
40
|
},
|
|
37
41
|
|
|
38
42
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
showSmall="{{false}}"
|
|
5
5
|
uid="{{mainRemotePlayer.uid}}"
|
|
6
6
|
url="{{mainRemotePlayer.url}}"
|
|
7
|
-
|
|
7
|
+
selfInVoice="{{selfInVoice || remoteAudioStatus['' + mainRemotePlayer.uid]}}"
|
|
8
8
|
bindnetstatus="onPlayerNetstatus"
|
|
9
9
|
bindstatechange="onPlayerStatechange"
|
|
10
10
|
/>
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
bindnetstatus="onPusherNetstatus"
|
|
21
21
|
bindstatechange="onPusherStatechange"
|
|
22
22
|
chatting="{{mainRemotePlayer != null}}"
|
|
23
|
-
|
|
23
|
+
selfInVoice="{{selfInVoice}}"
|
|
24
|
+
selfInVoice="{{selfInVoice}}"
|
|
24
25
|
/>
|
|
25
26
|
<block
|
|
26
27
|
wx:if="{{remotePlayerList}}"
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
showSmall="{{true}}"
|
|
34
35
|
uid="{{item.uid}}"
|
|
35
36
|
url="{{item.url}}"
|
|
36
|
-
|
|
37
|
+
selfInVoice="{{selfInVoice || remoteAudioStatus['' + item.uid]}}"
|
|
37
38
|
bindnetstatus="onPlayerNetstatus"
|
|
38
39
|
bindstatechange="onPlayerStatechange"
|
|
39
40
|
/>
|
|
@@ -17,10 +17,14 @@ Component({
|
|
|
17
17
|
type: String,
|
|
18
18
|
value: null
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
selfInVoice: {
|
|
21
21
|
type: Boolean,
|
|
22
|
-
value: false
|
|
22
|
+
value: false
|
|
23
23
|
},
|
|
24
|
+
selfInVoice: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
value: false
|
|
27
|
+
}
|
|
24
28
|
},
|
|
25
29
|
|
|
26
30
|
/**
|
|
@@ -293,9 +297,15 @@ Component({
|
|
|
293
297
|
},
|
|
294
298
|
switchAudioVideo(toAudio) {
|
|
295
299
|
if (toAudio) {
|
|
296
|
-
this.TRTC.getPusherInstance().pause()
|
|
300
|
+
// this.TRTC.getPusherInstance().pause()
|
|
301
|
+
this.setPusherAttributesHandler({
|
|
302
|
+
enableCamera: false,
|
|
303
|
+
})
|
|
297
304
|
} else {
|
|
298
|
-
this.TRTC.getPusherInstance().resume()
|
|
305
|
+
// this.TRTC.getPusherInstance().resume()
|
|
306
|
+
this.setPusherAttributesHandler({
|
|
307
|
+
enableCamera: true,
|
|
308
|
+
})
|
|
299
309
|
}
|
|
300
310
|
},
|
|
301
311
|
switchCamera() {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
wx:if="{{mainRemotePlayer}}"
|
|
4
4
|
remoteUser="{{mainRemotePlayer}}"
|
|
5
5
|
showSmall="{{false}}"
|
|
6
|
-
|
|
6
|
+
selfInVoice="{{selfInVoice || remoteAudioStatus['' + mainRemotePlayer.userID]}}"
|
|
7
7
|
bind:playerStateChange="_playerStateChange"
|
|
8
8
|
bind:playerFullscreenChange="_playerFullscreenChange"
|
|
9
9
|
bind:playerNetStatus="_playerNetStatus"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
mode="{{pusher.mode}}"
|
|
34
34
|
url="{{pusher.url}}"
|
|
35
35
|
/>
|
|
36
|
-
<view wx:if="{{
|
|
36
|
+
<view wx:if="{{selfInVoice}}" class="cover-view small">
|
|
37
37
|
<image class="pusher-cover-image" src="{{expertAvatar}}" />
|
|
38
38
|
</view>
|
|
39
39
|
</view>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
wx:if="{{item}}"
|
|
47
47
|
remoteUser="{{item}}"
|
|
48
48
|
showSmall="{{true}}"
|
|
49
|
-
|
|
49
|
+
selfInVoice="{{selfInVoice || remoteAudioStatus['' + item.userID]}}"
|
|
50
50
|
bind:playerStateChange="_playerStateChange"
|
|
51
51
|
bind:playerFullscreenChange="_playerFullscreenChange"
|
|
52
52
|
bind:playerNetStatus="_playerNetStatus"
|
|
@@ -33,9 +33,9 @@ module.exports = Behavior({
|
|
|
33
33
|
userIdList: [],
|
|
34
34
|
hangupType: null,
|
|
35
35
|
newCases: false,
|
|
36
|
-
isInVoice: false,
|
|
37
36
|
expertAvatar: null,
|
|
38
|
-
remoteAudioStatus: {},
|
|
37
|
+
remoteAudioStatus: {}, // 远端用户语音视频状态
|
|
38
|
+
selfInVoice: false, // 自己是否处于语音状态
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
methods: {
|
|
@@ -218,28 +218,35 @@ module.exports = Behavior({
|
|
|
218
218
|
* 切换语音和视频状态
|
|
219
219
|
*/
|
|
220
220
|
_controllerChangeVoiceVideo() {
|
|
221
|
-
|
|
222
|
-
this.setData({
|
|
223
|
-
isInVoice: isInVoice,
|
|
224
|
-
})
|
|
225
|
-
const isFromAgora = this.data.isFromAgora
|
|
221
|
+
this.switchSelfAudioState()
|
|
226
222
|
message_api.bindData({
|
|
227
223
|
'toUUID': this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
|
|
228
224
|
'orderId': this.data.orderId
|
|
229
225
|
})
|
|
230
|
-
|
|
226
|
+
const selfInVoice = !this.data.selfInVoice
|
|
227
|
+
const isFromAgora = this.data.isFromAgora
|
|
228
|
+
if (selfInVoice) {
|
|
229
|
+
message_api.sendSwitch2Audio(isFromAgora)
|
|
230
|
+
} else {
|
|
231
|
+
message_api.sendSwitch2Video(isFromAgora)
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
switchSelfAudioState(toVoice) {
|
|
236
|
+
const selfInVoice = toVoice || !this.data.selfInVoice
|
|
237
|
+
this.setData({
|
|
238
|
+
selfInVoice: selfInVoice,
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
wx.statLog.sendStatLog(null, `切换语音视频,切换为${selfInVoice ? '音频' : '视频'}`)
|
|
231
242
|
if (this.data.isFromAgora) {
|
|
232
243
|
wx.statLog.sendStatLog(null, '切换语音视频(声网RTC)')
|
|
233
|
-
this.selectComponent('#artc').switchAudioVideo(
|
|
244
|
+
this.selectComponent('#artc').switchAudioVideo(selfInVoice)
|
|
234
245
|
} else {
|
|
235
246
|
wx.statLog.sendStatLog(null, '切换语音视频(腾讯RTC)')
|
|
236
|
-
this.selectComponent('#trtc').switchAudioVideo(
|
|
237
|
-
}
|
|
238
|
-
if (isInVoice) {
|
|
239
|
-
message_api.sendSwitch2Audio(isFromAgora)
|
|
240
|
-
} else {
|
|
241
|
-
message_api.sendSwitch2Video(isFromAgora)
|
|
247
|
+
this.selectComponent('#trtc').switchAudioVideo(selfInVoice)
|
|
242
248
|
}
|
|
249
|
+
|
|
243
250
|
},
|
|
244
251
|
|
|
245
252
|
/**
|
|
@@ -298,7 +305,7 @@ module.exports = Behavior({
|
|
|
298
305
|
wx.statLog.sendStatLog(null, '发送呼叫消息')
|
|
299
306
|
return new Promise((resolve, reject) => {
|
|
300
307
|
message_api.bindData({
|
|
301
|
-
'toUUID': this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
|
|
308
|
+
'toUUID': this.data.order.doctorUuid, //this.data.isFamilyOrder ? this.data.order.patient.patientUuid : this.data.order.doctorUuid,
|
|
302
309
|
'orderId': this.data.orderId
|
|
303
310
|
})
|
|
304
311
|
message_api.sendCall().then((res) => {
|
|
@@ -137,7 +137,7 @@ Page({
|
|
|
137
137
|
event: imManager.EventNames.IMCustomMessage,
|
|
138
138
|
'listener': (params) => {
|
|
139
139
|
wx.statLog.sendStatLog(this.data.orderId, `收到IM消息(${JSON.stringify(params)})`)
|
|
140
|
-
console.error(`收到IM消息(${JSON.stringify(params)})`)
|
|
140
|
+
// console.error(`收到IM消息(${JSON.stringify(params)})`)
|
|
141
141
|
if (params) {
|
|
142
142
|
this.onMessage(params.command, params.uuid)
|
|
143
143
|
}
|
|
@@ -180,14 +180,14 @@ Page({
|
|
|
180
180
|
case defines.commands.switchToAudioAgora:
|
|
181
181
|
// this.updateUserAudioStatus(uuid, true)
|
|
182
182
|
// this.setData({
|
|
183
|
-
//
|
|
183
|
+
// selfInVoice: true,
|
|
184
184
|
// })
|
|
185
185
|
break
|
|
186
186
|
case defines.commands.switchToVideoWMP:
|
|
187
187
|
case defines.commands.switchToVideoAgora:
|
|
188
188
|
// this.updateUserAudioStatus(uuid, false)
|
|
189
189
|
// this.setData({
|
|
190
|
-
//
|
|
190
|
+
// selfInVoice: false,
|
|
191
191
|
// })
|
|
192
192
|
break
|
|
193
193
|
}
|
|
@@ -215,26 +215,26 @@ Page({
|
|
|
215
215
|
}
|
|
216
216
|
},
|
|
217
217
|
|
|
218
|
-
updateUserAudioStatus(data) {
|
|
218
|
+
updateUserAudioStatus(data) {
|
|
219
219
|
const {
|
|
220
220
|
userId,
|
|
221
221
|
audio
|
|
222
222
|
} = data.detail
|
|
223
223
|
let remoteAudioStatus = this.data.remoteAudioStatus
|
|
224
224
|
remoteAudioStatus[userId] = audio
|
|
225
|
-
let
|
|
226
|
-
this.data.userIdList.forEach((userId) => {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
});
|
|
225
|
+
// let toAudio = true
|
|
226
|
+
// this.data.userIdList.forEach((userId) => {
|
|
227
|
+
// if (!remoteAudioStatus[userId]) {
|
|
228
|
+
// toAudio = false
|
|
229
|
+
// }
|
|
230
|
+
// });
|
|
231
|
+
|
|
231
232
|
if (this.data.isFromAgora) {
|
|
232
233
|
this.selectComponent('#artc').updateAudioStatus(remoteAudioStatus)
|
|
233
234
|
} else {
|
|
234
235
|
this.selectComponent('#trtc').updateAudioStatus(remoteAudioStatus)
|
|
235
236
|
}
|
|
236
237
|
this.setData({
|
|
237
|
-
isInVoice: inAudio,
|
|
238
238
|
remoteAudioStatus: remoteAudioStatus,
|
|
239
239
|
})
|
|
240
240
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
orderId="{{orderId}}"
|
|
7
7
|
order="{{order}}"
|
|
8
8
|
callback="{{callback}}"
|
|
9
|
-
|
|
9
|
+
selfInVoice="{{selfInVoice}}"
|
|
10
10
|
smallVideoTop="{{smallVideoTop}}"
|
|
11
11
|
isFamilyOrder="{{isFamilyOrder}}"
|
|
12
12
|
expertAvatar="{{expertAvatar}}"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
orderId="{{orderId}}"
|
|
26
26
|
order="{{order}}"
|
|
27
27
|
callback="{{callback}}"
|
|
28
|
-
|
|
28
|
+
selfInVoice="{{selfInVoice}}"
|
|
29
29
|
smallVideoTop="{{smallVideoTop}}"
|
|
30
30
|
isFamilyOrder="{{isFamilyOrder}}"
|
|
31
31
|
expertAvatar="{{expertAvatar}}"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
startChatTime="{{startChatTime}}"
|
|
45
45
|
newCases="{{newCases}}"
|
|
46
46
|
callback="{{callback}}"
|
|
47
|
-
|
|
47
|
+
selfInVoice="{{selfInVoice}}"
|
|
48
48
|
bind:hangup="_controllerHangup"
|
|
49
49
|
bind:changeVoice="_controllerChangeVoiceVideo"
|
|
50
50
|
bind:clickViewCase="_viewCase"
|