@tencentcloud/trtc-component-wx 1.0.1 → 1.0.2
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/miniprogram_dist/trtc-player.js +11 -1
- package/miniprogram_dist/trtc-player.js.map +1 -1
- package/miniprogram_dist/trtc-player.wxml +1 -1
- package/miniprogram_dist/trtc-pusher.js +9 -0
- package/miniprogram_dist/trtc-pusher.js.map +1 -1
- package/miniprogram_dist/trtc-pusher.wxml +2 -0
- package/miniprogram_dist/trtc-pusher.wxss +5 -0
- package/package.json +4 -4
- package/pnpm-lock.yaml +8018 -0
- package/src/trtc-player.js +9 -1
- package/src/trtc-player.wxml +1 -1
- package/src/trtc-pusher.js +7 -0
- package/src/trtc-pusher.wxml +2 -0
- package/src/trtc-pusher.wxss +5 -0
package/src/trtc-player.js
CHANGED
|
@@ -10,7 +10,8 @@ Component({
|
|
|
10
10
|
},
|
|
11
11
|
data: {
|
|
12
12
|
player: {},
|
|
13
|
-
TRTCStreamId: ''
|
|
13
|
+
TRTCStreamId: '',
|
|
14
|
+
soundMode: ''
|
|
14
15
|
},
|
|
15
16
|
lifetimes: {
|
|
16
17
|
attached() {
|
|
@@ -54,6 +55,11 @@ Component({
|
|
|
54
55
|
this.setData({player: playerAttributes}, callback)
|
|
55
56
|
}
|
|
56
57
|
},
|
|
58
|
+
playerAudioRouteChange(event) {
|
|
59
|
+
const { soundMode, callback } = event
|
|
60
|
+
trtcCloud.logger.info('trtc-player playerAudioRouteChange', soundMode)
|
|
61
|
+
this.setData({ soundMode }, callback)
|
|
62
|
+
},
|
|
57
63
|
getTRTCStreamId(streamId) {
|
|
58
64
|
const tempArray = streamId.split('_')
|
|
59
65
|
const userId = tempArray.slice(0, -1).join('_')
|
|
@@ -62,9 +68,11 @@ Component({
|
|
|
62
68
|
},
|
|
63
69
|
bindTRTCCloudEvent() {
|
|
64
70
|
InterfaceEventEmitter.on('playerAttributesChange', this.playerAttributesChange, this)
|
|
71
|
+
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange, this)
|
|
65
72
|
},
|
|
66
73
|
unbindTRTCCloudEvent() {
|
|
67
74
|
InterfaceEventEmitter.off('playerAttributesChange', this.playerAttributesChange)
|
|
75
|
+
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange)
|
|
68
76
|
},
|
|
69
77
|
// 请保持跟 wxml 中绑定的事件名称一致
|
|
70
78
|
_playerStateChange(event) {
|
package/src/trtc-player.wxml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
autoplay="{{player.autoplay}}" mute-audio="{{player.muteAudio}}" mute-video="{{player.muteVideo}}"
|
|
5
5
|
orientation="{{player.orientation}}" object-fit="{{player.objectFit}}"
|
|
6
6
|
background-mute="{{player.enableBackgroundMute}}" min-cache="{{player.minCache}}" max-cache="{{player.maxCache}}"
|
|
7
|
-
sound-mode="{{
|
|
7
|
+
sound-mode="{{soundMode}}" enable-recv-message="{{player.enableRecvMessage}}"
|
|
8
8
|
auto-pause-if-navigate="{{player.autoPauseIfNavigate}}" auto-pause-if-open-native="{{player.autoPauseIfOpenNative}}"
|
|
9
9
|
debug="{{player.debug}}" bindstatechange="_playerStateChange" bindfullscreenchange="_playerFullscreenChange"
|
|
10
10
|
bindnetstatus="_playerNetStatus" bindaudiovolumenotify="_playerAudioVolumeNotify" />
|
package/src/trtc-pusher.js
CHANGED
|
@@ -31,11 +31,18 @@ Component({
|
|
|
31
31
|
const {pusher, callback} = event
|
|
32
32
|
this.setData({pusher}, callback)
|
|
33
33
|
},
|
|
34
|
+
playerAudioRouteChange(event) {
|
|
35
|
+
const { soundMode, callback } = event
|
|
36
|
+
trtcCloud.logger.info('trtc-player playerAudioRouteChange', soundMode)
|
|
37
|
+
this.setData({ soundMode }, callback)
|
|
38
|
+
},
|
|
34
39
|
bindTRTCCloudEvent() {
|
|
35
40
|
InterfaceEventEmitter.on('pusherAttributesChange', this.pusherAttributesChange, this)
|
|
41
|
+
InterfaceEventEmitter.on('playerAudioRouteChange', this.playerAudioRouteChange, this)
|
|
36
42
|
},
|
|
37
43
|
unbindTRTCCloudEvent() {
|
|
38
44
|
InterfaceEventEmitter.off('pusherAttributesChange', this.pusherAttributesChange)
|
|
45
|
+
InterfaceEventEmitter.off('playerAudioRouteChange', this.playerAudioRouteChange)
|
|
39
46
|
},
|
|
40
47
|
// 请保持跟 wxml 中绑定的事件名称一致
|
|
41
48
|
_pusherStateChangeHandler(event) {
|
package/src/trtc-pusher.wxml
CHANGED
|
@@ -16,5 +16,7 @@
|
|
|
16
16
|
binderror="_pusherErrorHandler" bindbgmstart="_pusherBGMStartHandler"
|
|
17
17
|
bindbgmprogress="_pusherBGMProgressHandler" bindbgmcomplete="_pusherBGMCompleteHandler"
|
|
18
18
|
bindaudiovolumenotify="_pusherAudioVolumeNotify" />
|
|
19
|
+
<live-player class="trtc-player" sound-mode="{{soundMode}}">
|
|
20
|
+
</live-player>
|
|
19
21
|
<!-- <camera wx:if="{{pusher.videoPreview}}" class="trtc-camera" device-position="{{pusher.frontCamera}}"></camera> -->
|
|
20
22
|
</view>
|