This commit is contained in:
tdg930622 2025-01-08 18:19:00 +08:00
parent 748ab4c25d
commit 38e1bc3215
2 changed files with 41 additions and 18 deletions

View File

@ -53,6 +53,7 @@
<script> <script>
import TRTC from 'trtc-sdk-v5'; import TRTC from 'trtc-sdk-v5';
import videoTelephone from "@/services/videoTelephone";
export default { export default {
props: { props: {
eventDialog: { eventDialog: {
@ -66,12 +67,13 @@ export default {
return { return {
zoomActive: true,// true false zoomActive: true,// true false
roomId: '', roomId: 0,
sdkAppId: '', sdkAppId: 0,
userId: '', userId: '',
userSig: '', userSig: '',
cameraId: '',// cameraId: '',//
microphoneId: '',// microphoneId: '',//
camStatus: false,//
vidStatus: false,// vidStatus: false,//
micStatus: false,// micStatus: false,//
@ -95,7 +97,8 @@ export default {
} }
}, },
mounted() { mounted() {
this.initMedia() this.initMedia();
this.getRoomArgument();
}, },
methods: { methods: {
handleClose() { handleClose() {
@ -113,6 +116,19 @@ export default {
}); });
}, },
//
getRoomArgument() {
videoTelephone.getEnterById({id: this.eventDialog.id}).then((res) => {
let {roomId, sdkAppId, userId, userSig} = res;
this.roomId = roomId;
this.sdkAppId = sdkAppId;
this.userId = userId;
this.userSig = userSig;
console.log(res, '---房间参数')
this.handleEnterRoom();
});
},
// //
async getDeviceList() { async getDeviceList() {
let camera = await TRTC.getCameraList(); let camera = await TRTC.getCameraList();
@ -137,13 +153,6 @@ export default {
}, },
// //
handleEnterRoom() { handleEnterRoom() {
let data = {
sdkSecretKey: '',
sdkAppId: '',
userId: '',
roomId: '',
userSig: ''
}
this.enterRoom(); this.enterRoom();
this.handleStartLocalAudio(); this.handleStartLocalAudio();
this.handleStartLocalVideo(); this.handleStartLocalVideo();
@ -153,7 +162,8 @@ export default {
try { try {
await this.trtc.enterRoom({ await this.trtc.enterRoom({
roomId: this.roomId, roomId: this.roomId,
sdkAppId: parseInt(this.sdkAppId, 10), // sdkAppId: parseInt(this.sdkAppId, 10),
sdkAppId: this.sdkAppId,
userId: this.userId, userId: this.userId,
userSig: this.userSig, userSig: this.userSig,
}); });
@ -200,12 +210,13 @@ export default {
} }
try { try {
await this.trtc.startLocalVideo({ await this.trtc.startLocalVideo({
view: 'local', view: 'realTimeVideo0',
option: { option: {
cameraId: this.cameraId, cameraId: this.cameraId,
profile: '1080p', profile: '1080p',
}, },
}); });
this.camStatus = true;
this.vidStatus = true; this.vidStatus = true;
} catch (error) { } catch (error) {
throw error; throw error;
@ -275,6 +286,7 @@ export default {
}, },
// //
handleRemoteVideoAvailable(event) { handleRemoteVideoAvailable(event) {
console.log(event, '---event远端进入房间')
const { userId, streamType } = event; const { userId, streamType } = event;
try { try {
let data = { let data = {
@ -293,6 +305,7 @@ export default {
}, },
// 退 // 退
handleRemoteVideoUnavailable(event) { handleRemoteVideoUnavailable(event) {
console.log(event, '---event远端退出房间')
const { streamType } = event; const { streamType } = event;
this.trtc.stopRemoteVideo({ userId: event.userId, streamType }); this.trtc.stopRemoteVideo({ userId: event.userId, streamType });
this.personnelNumber--; this.personnelNumber--;

View File

@ -27,14 +27,18 @@
<div class="f12">{{item.content}}</div> <div class="f12">{{item.content}}</div>
<div class="flex-row align-items-center"> <div class="flex-row align-items-center">
<div class="f16 mr-8 cursor-pointer" <div class="f16 mr-8 cursor-pointer"
@click="handleVideoCall"> v-if="item.roomId && item.sdkAppId && item.userId && item.userSig"
@click="handleVideoCall(item)">
<i class="el-icon-video-camera"></i> <i class="el-icon-video-camera"></i>
</div> </div>
<div class="f16 mr-8 cursor-pointer" <div class="f16 mr-8 cursor-pointer"
v-if="item.status.code === 0"
@click="VideoEditDialog={id:item.id, bookingTime:item.bookingTime}"> @click="VideoEditDialog={id:item.id, bookingTime:item.bookingTime}">
<i class="el-icon-edit-outline"></i> <i class="el-icon-edit-outline"></i>
</div> </div>
<div class="f16 mr-8 cursor-pointer" @click="handleBackCase(item)"> <div class="f16 mr-8 cursor-pointer"
v-if="item.status.code === 1"
@click="handleBackCase(item)">
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</div> </div>
</div> </div>
@ -49,7 +53,7 @@
<!-- 视频预约修改 --> <!-- 视频预约修改 -->
<videoReservationEditDialog v-if="VideoEditDialog" :eventDialog.sync="VideoEditDialog" /> <videoReservationEditDialog v-if="VideoEditDialog" :eventDialog.sync="VideoEditDialog" />
<!-- 视频房间 --> <!-- 视频房间 -->
<VideoRoom v-if="VideoCallDialog" :eventDialog.sync="VideoCallDialog" /> <!-- <VideoRoom v-if="VideoCallDialog" :eventDialog.sync="VideoCallDialog" />-->
</div> </div>
</template> </template>
@ -60,7 +64,7 @@ export default {
components: { components: {
VideoReservationDialog: () => import('./VideoReservationDialog'),// VideoReservationDialog: () => import('./VideoReservationDialog'),//
videoReservationEditDialog: () => import('../../event-tracing/components/videoReservationDialog'),// videoReservationEditDialog: () => import('../../event-tracing/components/videoReservationDialog'),//
VideoRoom: () => import('./VideoRoom'), // VideoRoom: () => import('./VideoRoom'),
}, },
props: { props: {
visiblePopover: { visiblePopover: {
@ -84,7 +88,7 @@ export default {
videoTableData: [], videoTableData: [],
VideoDialog: null, VideoDialog: null,
VideoEditDialog: null, VideoEditDialog: null,
VideoCallDialog: null // VideoCallDialog: null
} }
}, },
mounted() { mounted() {
@ -125,7 +129,13 @@ export default {
}).catch(() => {}); }).catch(() => {});
}, },
handleVideoCall(item) { handleVideoCall(item) {
this.$parent.VideoCallDialog = {id: item.id} this.$parent.VideoCallDialog = {
id: item.id,
roomId: item.roomId,
sdkAppId: item.sdkAppId,
userId: item.userId,
userSig: item.userSig
}
// this.VideoCallDialog = { // this.VideoCallDialog = {
// id: item.id // id: item.id
// } // }