|
@@ -1,6 +1,12 @@
|
|
<template>
|
|
<template>
|
|
<view class="container">
|
|
<view class="container">
|
|
<trtc-room ref="trtc-component" :config="rtcConfig"> </trtc-room>
|
|
<trtc-room ref="trtc-component" :config="rtcConfig"> </trtc-room>
|
|
|
|
+ <view class="top_box" :style="{ top: btn_top, left: btn_left}">
|
|
|
|
+ <image class="top_box_img" :src="head_img"></image>
|
|
|
|
+ <view class="top_box_text">
|
|
|
|
+ <text class="text_box_top">{{title}}</text><text class="text_box_bottom">{{user_name}}</text>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
<view class="popup-open" @click="showGoods()">
|
|
<view class="popup-open" @click="showGoods()">
|
|
<view class="iconfont iconzhibo-shangpin"></view>
|
|
<view class="iconfont iconzhibo-shangpin"></view>
|
|
</view>
|
|
</view>
|
|
@@ -58,7 +64,12 @@
|
|
template: '' // 必要参数 组件模版,支持的值 1v1 grid custom ,注意:不支持动态修改, iOS 不支持 pusher 动态渲染
|
|
template: '' // 必要参数 组件模版,支持的值 1v1 grid custom ,注意:不支持动态修改, iOS 不支持 pusher 动态渲染
|
|
},
|
|
},
|
|
showTipToast: false,
|
|
showTipToast: false,
|
|
- options: {}
|
|
|
|
|
|
+ options: {},
|
|
|
|
+ btn_left:0,
|
|
|
|
+ btn_top:0,
|
|
|
|
+ title:"888",
|
|
|
|
+ user_name:'1',
|
|
|
|
+ head_img:"../static/images/loginLogo.png"
|
|
}
|
|
}
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
@@ -75,6 +86,17 @@
|
|
})
|
|
})
|
|
},
|
|
},
|
|
onReady() {
|
|
onReady() {
|
|
|
|
+ let menuButtonObject = wx.getMenuButtonBoundingClientRect();
|
|
|
|
+ wx.getSystemInfo({
|
|
|
|
+ success: res => {
|
|
|
|
+ this.setData({
|
|
|
|
+ btn_left: res.windowWidth - menuButtonObject.right+'rpx',
|
|
|
|
+ btn_top:menuButtonObject.top+menuButtonObject.height+14+'rpx',
|
|
|
|
+ head_img:uni.getStorageSync("liveImgUrl"),
|
|
|
|
+ title:uni.getStorageSync("liveName"),
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ })
|
|
wx.setKeepScreenOn({
|
|
wx.setKeepScreenOn({
|
|
keepScreenOn: true
|
|
keepScreenOn: true
|
|
}); // 获取 rtcroom 实例
|
|
}); // 获取 rtcroom 实例
|
|
@@ -128,6 +150,7 @@
|
|
localMirror: 'auto',
|
|
localMirror: 'auto',
|
|
enableAgc: true,
|
|
enableAgc: true,
|
|
enableAns: true,
|
|
enableAns: true,
|
|
|
|
+ enableMic:false,
|
|
encsmall: false ? 1 : 0,
|
|
encsmall: false ? 1 : 0,
|
|
videoWidth: 1280,
|
|
videoWidth: 1280,
|
|
videoHeight: 720,
|
|
videoHeight: 720,
|
|
@@ -162,12 +185,16 @@
|
|
const TRTC_EVENT = this.trtcComponent.EVENT;
|
|
const TRTC_EVENT = this.trtcComponent.EVENT;
|
|
this.timestamp = []; // 初始化事件订阅
|
|
this.timestamp = []; // 初始化事件订阅
|
|
this.trtcComponent.on(TRTC_EVENT.LOCAL_JOIN, event => {
|
|
this.trtcComponent.on(TRTC_EVENT.LOCAL_JOIN, event => {
|
|
|
|
+ let user_list=this.trtcComponent.getRemoteUserList();
|
|
|
|
+ this.setData({
|
|
|
|
+ user_name:user_list.length
|
|
|
|
+ })
|
|
console.log('* room LOCAL_JOIN', event); // 进房成功,触发该事件后可以对本地视频和音频进行设置
|
|
console.log('* room LOCAL_JOIN', event); // 进房成功,触发该事件后可以对本地视频和音频进行设置
|
|
if (this.options.localVideo === true || this.options.template === '1v1') {
|
|
if (this.options.localVideo === true || this.options.template === '1v1') {
|
|
- this.trtcComponent.publishLocalVideo();
|
|
|
|
|
|
+ //this.trtcComponent.publishLocalVideo();
|
|
}
|
|
}
|
|
if (this.options.localAudio === true || this.options.template === '1v1') {
|
|
if (this.options.localAudio === true || this.options.template === '1v1') {
|
|
- this.trtcComponent.publishLocalAudio();
|
|
|
|
|
|
+ //this.trtcComponent.publishLocalAudio();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
this.trtcComponent.on(TRTC_EVENT.LOCAL_LEAVE, event => {
|
|
this.trtcComponent.on(TRTC_EVENT.LOCAL_LEAVE, event => {
|
|
@@ -177,6 +204,10 @@
|
|
console.log('* room ERROR', event);
|
|
console.log('* room ERROR', event);
|
|
}); // 远端用户进房
|
|
}); // 远端用户进房
|
|
this.trtcComponent.on(TRTC_EVENT.REMOTE_USER_JOIN, event => {
|
|
this.trtcComponent.on(TRTC_EVENT.REMOTE_USER_JOIN, event => {
|
|
|
|
+ let user_list=this.trtcComponent.getRemoteUserList();
|
|
|
|
+ this.setData({
|
|
|
|
+ user_name:user_list.length
|
|
|
|
+ })
|
|
console.log('* room REMOTE_USER_JOIN --- room.vue', event, this.trtcComponent.getRemoteUserList(), this.template);
|
|
console.log('* room REMOTE_USER_JOIN --- room.vue', event, this.trtcComponent.getRemoteUserList(), this.template);
|
|
this.timestamp.push(new Date()); // 1v1视频通话时限制人数为两人的简易逻辑,建议通过后端实现房间人数管理
|
|
this.timestamp.push(new Date()); // 1v1视频通话时限制人数为两人的简易逻辑,建议通过后端实现房间人数管理
|
|
// 2人以上同时进行通话请选择网格布局
|
|
// 2人以上同时进行通话请选择网格布局
|
|
@@ -200,6 +231,10 @@
|
|
}
|
|
}
|
|
}); // 远端用户退出
|
|
}); // 远端用户退出
|
|
this.trtcComponent.on(TRTC_EVENT.REMOTE_USER_LEAVE, event => {
|
|
this.trtcComponent.on(TRTC_EVENT.REMOTE_USER_LEAVE, event => {
|
|
|
|
+ let user_list=this.trtcComponent.getRemoteUserList();
|
|
|
|
+ this.setData({
|
|
|
|
+ user_name:user_list.length
|
|
|
|
+ })
|
|
if (event.data.userID == this.userID) {
|
|
if (event.data.userID == this.userID) {
|
|
console.log("直播用户退出");
|
|
console.log("直播用户退出");
|
|
this.$refs.uTips.show({
|
|
this.$refs.uTips.show({
|
|
@@ -423,5 +458,41 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ .top_box{
|
|
|
|
+ width: 304rpx;
|
|
|
|
+ height: 86rpx;
|
|
|
|
+ position: absolute;
|
|
|
|
+ z-index: 100;
|
|
|
|
+ background:rgba(0, 0, 0, 0.4);
|
|
|
|
+ border-radius: 100px;
|
|
|
|
+ top: 182rpx;
|
|
|
|
+ left: 30rpx;
|
|
|
|
+ }
|
|
|
|
+ .top_box_img{
|
|
|
|
+ width: 86rpx;
|
|
|
|
+ height: 86rpx;
|
|
|
|
+ border-radius: 100rpx;
|
|
|
|
+ float: left;
|
|
|
|
+ }
|
|
|
|
+ .top_box_text{
|
|
|
|
+ float: left;
|
|
|
|
+ color: #fff;
|
|
|
|
+ margin-left: 30rpx;
|
|
|
|
+ width: 180rpx;
|
|
|
|
+ padding-top: 2rpx;
|
|
|
|
+ }
|
|
|
|
+ .text_box_top{
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ width: 100%;
|
|
|
|
+ display: block;
|
|
|
|
+ height: 30rpx;
|
|
|
|
+ float: left;
|
|
|
|
+ margin-top: 6rpx;
|
|
|
|
+ }
|
|
|
|
+ .text_box_bottom{
|
|
|
|
+ font-size: 22rpx;
|
|
|
|
+ float: left;
|
|
|
|
+ margin-top: 10rpx;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|