|
@@ -1,186 +1,204 @@
|
|
|
-import { defineComponent, ref } from 'vue'
|
|
|
|
|
-import * as RTC from '@rongcloud/plugin-rtc'
|
|
|
|
|
-import Header from './header'
|
|
|
|
|
-import ActionBar, { state as ActionBarRuntime } from './action-bar'
|
|
|
|
|
-import VideoStatus from './video-status'
|
|
|
|
|
-import { state } from '/src/state'
|
|
|
|
|
-import event, { LIVE_EVENT_MESSAGE } from './event'
|
|
|
|
|
-import runtime, * as RuntimeUtils from './runtime'
|
|
|
|
|
-import Chronography from './chronography'
|
|
|
|
|
-import runtimeModel, * as RuntimeModelUtils from '/src/components/live-message/model/runtime'
|
|
|
|
|
-import { requireMedia } from './helpers'
|
|
|
|
|
-import styles from './index.module.less'
|
|
|
|
|
-import request from '/src/helpers/request'
|
|
|
|
|
|
|
+import { defineComponent, ref } from "vue";
|
|
|
|
|
+import * as RTC from "@rongcloud/plugin-rtc";
|
|
|
|
|
+import Header from "./header";
|
|
|
|
|
+import ActionBar, { state as ActionBarRuntime } from "./action-bar";
|
|
|
|
|
+import VideoStatus from "./video-status";
|
|
|
|
|
+import { state } from "/src/state";
|
|
|
|
|
+import event, { LIVE_EVENT_MESSAGE } from "./event";
|
|
|
|
|
+import runtime, * as RuntimeUtils from "./runtime";
|
|
|
|
|
+import Chronography from "./chronography";
|
|
|
|
|
+import runtimeModel, * as RuntimeModelUtils from "/src/components/live-message/model/runtime";
|
|
|
|
|
+import { requireMedia } from "./helpers";
|
|
|
|
|
+import styles from "./index.module.less";
|
|
|
|
|
+import request from "/src/helpers/request";
|
|
|
|
|
+import dayjs from "dayjs";
|
|
|
|
|
|
|
|
-const videoRef = ref<HTMLVideoElement | null>(null)
|
|
|
|
|
|
|
+const videoRef = ref<HTMLVideoElement | null>(null);
|
|
|
|
|
|
|
|
-let microphoneAudioTrack: RTC.RCLocalTrack
|
|
|
|
|
-let cameraVideoTrack: RTC.RCLocalTrack
|
|
|
|
|
|
|
+let microphoneAudioTrack: RTC.RCLocalTrack;
|
|
|
|
|
+let cameraVideoTrack: RTC.RCLocalTrack;
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
|
- name: 'LiveBroadcast',
|
|
|
|
|
|
|
+ name: "LiveBroadcast",
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
headerStatus: false,
|
|
headerStatus: false,
|
|
|
initAudioUsers: [],
|
|
initAudioUsers: [],
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
isLive() {
|
|
isLive() {
|
|
|
- console.log(runtime.videoStatus)
|
|
|
|
|
- if (runtime.videoStatus === 'liveing') {
|
|
|
|
|
|
|
+ console.log(runtime.videoStatus);
|
|
|
|
|
+ if (runtime.videoStatus === "liveing") {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
- this.headerStatus = true
|
|
|
|
|
- }, 3000)
|
|
|
|
|
|
|
+ this.headerStatus = true;
|
|
|
|
|
+ }, 3000);
|
|
|
} else {
|
|
} else {
|
|
|
- this.headerStatus = false
|
|
|
|
|
|
|
+ this.headerStatus = false;
|
|
|
}
|
|
}
|
|
|
- return runtime.videoStatus === 'liveing'
|
|
|
|
|
|
|
+ return runtime.videoStatus === "liveing";
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
async mounted() {
|
|
async mounted() {
|
|
|
- this.initializeRoom()
|
|
|
|
|
- RuntimeUtils.loopSyncLike()
|
|
|
|
|
- event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:Like'], this.onLikeMessage)
|
|
|
|
|
- window.onbeforeunload = this.beforeunload
|
|
|
|
|
|
|
+ this.initializeRoom();
|
|
|
|
|
+ RuntimeUtils.loopSyncLike();
|
|
|
|
|
+ event.on(LIVE_EVENT_MESSAGE["RC:Chatroom:Like"], this.onLikeMessage);
|
|
|
|
|
+ window.onbeforeunload = this.beforeunload;
|
|
|
// window.addEventListener('focus', this.visibilitychange)
|
|
// window.addEventListener('focus', this.visibilitychange)
|
|
|
// window.addEventListener('blur', this.visibilitychange)
|
|
// window.addEventListener('blur', this.visibilitychange)
|
|
|
},
|
|
},
|
|
|
beforeUnmount() {
|
|
beforeUnmount() {
|
|
|
- event.off(LIVE_EVENT_MESSAGE['RC:Chatroom:Like'], this.onLikeMessage)
|
|
|
|
|
- window.onbeforeunload = null
|
|
|
|
|
|
|
+ event.off(LIVE_EVENT_MESSAGE["RC:Chatroom:Like"], this.onLikeMessage);
|
|
|
|
|
+ window.onbeforeunload = null;
|
|
|
// window.removeEventListener('focus', this.visibilitychange)
|
|
// window.removeEventListener('focus', this.visibilitychange)
|
|
|
// window.removeEventListener('blur', this.visibilitychange)
|
|
// window.removeEventListener('blur', this.visibilitychange)
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
visibilitychange(evt: FocusEvent) {
|
|
visibilitychange(evt: FocusEvent) {
|
|
|
- console.log(evt)
|
|
|
|
|
- if (evt.type === 'focus') {
|
|
|
|
|
- document.exitPictureInPicture()
|
|
|
|
|
- document.body.click()
|
|
|
|
|
|
|
+ console.log(evt);
|
|
|
|
|
+ if (evt.type === "focus") {
|
|
|
|
|
+ document.exitPictureInPicture();
|
|
|
|
|
+ document.body.click();
|
|
|
}
|
|
}
|
|
|
- if (evt.type === 'blur') {
|
|
|
|
|
- runtime.videoRef?.requestPictureInPicture()
|
|
|
|
|
|
|
+ if (evt.type === "blur") {
|
|
|
|
|
+ runtime.videoRef?.requestPictureInPicture();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
beforeunload() {
|
|
beforeunload() {
|
|
|
- if (runtime.videoStatus === 'liveing') {
|
|
|
|
|
- return '当前正在直播中是否确认关闭页面?'
|
|
|
|
|
|
|
+ if (runtime.videoStatus === "liveing") {
|
|
|
|
|
+ return "当前正在直播中是否确认关闭页面?";
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLikeMessage(msg: any) {
|
|
onLikeMessage(msg: any) {
|
|
|
- runtime.likeCount += msg.counts
|
|
|
|
|
|
|
+ runtime.likeCount += msg.counts;
|
|
|
},
|
|
},
|
|
|
getDeviceByDeviceType(type: RuntimeUtils.TrackType) {
|
|
getDeviceByDeviceType(type: RuntimeUtils.TrackType) {
|
|
|
- const videoDeviceId = localStorage.getItem(RuntimeUtils.VIDEO_DEVICE_ID)
|
|
|
|
|
- const audioDeviceId = localStorage.getItem(RuntimeUtils.AUDIO_DEVICE_ID)
|
|
|
|
|
- const audioDeviceId2 = localStorage.getItem(RuntimeUtils.AUDIO_DEVICE_ID2)
|
|
|
|
|
- if (type === 'camera') {
|
|
|
|
|
|
|
+ const videoDeviceId = localStorage.getItem(RuntimeUtils.VIDEO_DEVICE_ID);
|
|
|
|
|
+ const audioDeviceId = localStorage.getItem(RuntimeUtils.AUDIO_DEVICE_ID);
|
|
|
|
|
+ const audioDeviceId2 = localStorage.getItem(
|
|
|
|
|
+ RuntimeUtils.AUDIO_DEVICE_ID2
|
|
|
|
|
+ );
|
|
|
|
|
+ if (type === "camera") {
|
|
|
if (videoDeviceId) {
|
|
if (videoDeviceId) {
|
|
|
return (
|
|
return (
|
|
|
runtime.cameras.find(
|
|
runtime.cameras.find(
|
|
|
(camera) => camera.deviceId === videoDeviceId
|
|
(camera) => camera.deviceId === videoDeviceId
|
|
|
) || runtime.cameras[0]
|
|
) || runtime.cameras[0]
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
- return runtime.cameras[0]
|
|
|
|
|
|
|
+ return runtime.cameras[0];
|
|
|
}
|
|
}
|
|
|
if (audioDeviceId) {
|
|
if (audioDeviceId) {
|
|
|
return (
|
|
return (
|
|
|
runtime.microphones.find(
|
|
runtime.microphones.find(
|
|
|
(microphone) => microphone.deviceId === audioDeviceId
|
|
(microphone) => microphone.deviceId === audioDeviceId
|
|
|
) || runtime.microphones[0]
|
|
) || runtime.microphones[0]
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
if (audioDeviceId2) {
|
|
if (audioDeviceId2) {
|
|
|
return (
|
|
return (
|
|
|
runtime.microphones.find(
|
|
runtime.microphones.find(
|
|
|
(microphone) => microphone.deviceId === audioDeviceId2
|
|
(microphone) => microphone.deviceId === audioDeviceId2
|
|
|
) || runtime.microphones[0]
|
|
) || runtime.microphones[0]
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
- return runtime.microphones[0]
|
|
|
|
|
|
|
+ return runtime.microphones[0];
|
|
|
},
|
|
},
|
|
|
async FetchUserDetails(userIds: string[]) {
|
|
async FetchUserDetails(userIds: string[]) {
|
|
|
try {
|
|
try {
|
|
|
const res = await request.post(
|
|
const res = await request.post(
|
|
|
- '/api-web/imLiveBroadcastRoom/queryBaseUserInfo',
|
|
|
|
|
|
|
+ "/api-web/imLiveBroadcastRoom/queryBaseUserInfo",
|
|
|
{
|
|
{
|
|
|
- requestType: 'json',
|
|
|
|
|
|
|
+ requestType: "json",
|
|
|
data: userIds,
|
|
data: userIds,
|
|
|
}
|
|
}
|
|
|
- )
|
|
|
|
|
- return res.data
|
|
|
|
|
|
|
+ );
|
|
|
|
|
+ return res.data;
|
|
|
} catch (error) {}
|
|
} catch (error) {}
|
|
|
- return []
|
|
|
|
|
|
|
+ return [];
|
|
|
},
|
|
},
|
|
|
async initializeRoom() {
|
|
async initializeRoom() {
|
|
|
- if (!state.user) throw Error('请先登录')
|
|
|
|
|
- let initAudioUsers: any[] = []
|
|
|
|
|
|
|
+ if (!state.user) throw Error("请先登录");
|
|
|
|
|
+ let initAudioUsers: any[] = [];
|
|
|
try {
|
|
try {
|
|
|
- runtime.likeCount = state.user?.likeNum || 0
|
|
|
|
|
- runtime.lookCount = state.user?.lookNum || 0
|
|
|
|
|
|
|
+ runtime.likeCount = state.user?.likeNum || 0;
|
|
|
|
|
+ runtime.lookCount = state.user?.lookNum || 0;
|
|
|
const isLiveing =
|
|
const isLiveing =
|
|
|
- sessionStorage.getItem(RuntimeUtils.START_LIVE_STATUS) === 'liveing'
|
|
|
|
|
|
|
+ sessionStorage.getItem(RuntimeUtils.START_LIVE_STATUS) === "liveing";
|
|
|
// IM连接
|
|
// IM连接
|
|
|
- await RuntimeUtils.connectIM(state.user?.imToken)
|
|
|
|
|
- runtime.videoRef = videoRef.value
|
|
|
|
|
|
|
+ await RuntimeUtils.connectIM(state.user?.imToken);
|
|
|
|
|
+ runtime.videoRef = videoRef.value;
|
|
|
// 获取设备
|
|
// 获取设备
|
|
|
- await RuntimeUtils.getMicrophones()
|
|
|
|
|
- await RuntimeUtils.getCameras()
|
|
|
|
|
|
|
+ await RuntimeUtils.getMicrophones();
|
|
|
|
|
+ await RuntimeUtils.getCameras();
|
|
|
// 设置播放设备
|
|
// 设置播放设备
|
|
|
- RuntimeUtils.setSelectCamera(this.getDeviceByDeviceType('camera'))
|
|
|
|
|
|
|
+ RuntimeUtils.setSelectCamera(this.getDeviceByDeviceType("camera"));
|
|
|
RuntimeUtils.setSelectMicrophone(
|
|
RuntimeUtils.setSelectMicrophone(
|
|
|
- this.getDeviceByDeviceType('microphone')
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ this.getDeviceByDeviceType("microphone")
|
|
|
|
|
+ );
|
|
|
// RuntimeUtils.setSelectMicrophone2(this.getDeviceByDeviceType('microphone2'))
|
|
// RuntimeUtils.setSelectMicrophone2(this.getDeviceByDeviceType('microphone2'))
|
|
|
- cameraVideoTrack = await RuntimeUtils.getTrack('camera')
|
|
|
|
|
- runtime.videoRef && cameraVideoTrack.play(runtime.videoRef)
|
|
|
|
|
|
|
+ cameraVideoTrack = await RuntimeUtils.getTrack("camera");
|
|
|
|
|
+ runtime.videoRef && cameraVideoTrack.play(runtime.videoRef);
|
|
|
// await RuntimeUtils.setTrack([cameraVideoTrack], 'camera', isLiveing)
|
|
// await RuntimeUtils.setTrack([cameraVideoTrack], 'camera', isLiveing)
|
|
|
// await RuntimeUtils.getTrack('microphone')
|
|
// await RuntimeUtils.getTrack('microphone')
|
|
|
- microphoneAudioTrack = await RuntimeUtils.getTrack('microphone')
|
|
|
|
|
|
|
+ microphoneAudioTrack = await RuntimeUtils.getTrack("microphone");
|
|
|
// microphoneAudioTrack.play()
|
|
// microphoneAudioTrack.play()
|
|
|
// console.log(microphoneAudioTrack)
|
|
// console.log(microphoneAudioTrack)
|
|
|
// console.log(runtime.deviceStatus)
|
|
// console.log(runtime.deviceStatus)
|
|
|
- runtime.videoStatus = 'stream'
|
|
|
|
|
|
|
+ runtime.videoStatus = "stream";
|
|
|
|
|
+ const _this = this;
|
|
|
const join = await RuntimeUtils.joinRoom(
|
|
const join = await RuntimeUtils.joinRoom(
|
|
|
state.user?.roomUid,
|
|
state.user?.roomUid,
|
|
|
RTC.RCLivingType.VIDEO,
|
|
RTC.RCLivingType.VIDEO,
|
|
|
{
|
|
{
|
|
|
onMessageReceive(name, content) {
|
|
onMessageReceive(name, content) {
|
|
|
- console.log(name, content)
|
|
|
|
|
|
|
+ console.log(name, content);
|
|
|
},
|
|
},
|
|
|
onKickOff(byServer: boolean) {
|
|
onKickOff(byServer: boolean) {
|
|
|
- console.log(byServer)
|
|
|
|
|
|
|
+ console.log(byServer);
|
|
|
},
|
|
},
|
|
|
async onTrackPublish(tracks: RTC.RCRemoteTrack[]) {
|
|
async onTrackPublish(tracks: RTC.RCRemoteTrack[]) {
|
|
|
- const subscribeRes = await join?.room?.subscribe(tracks)
|
|
|
|
|
- console.log(subscribeRes)
|
|
|
|
|
|
|
+ const subscribeRes = await join?.room?.subscribe(tracks);
|
|
|
|
|
+ console.log(subscribeRes, "subscribeRes");
|
|
|
if (
|
|
if (
|
|
|
subscribeRes?.code &&
|
|
subscribeRes?.code &&
|
|
|
subscribeRes.code !== RTC.RCRTCCode.SUCCESS
|
|
subscribeRes.code !== RTC.RCRTCCode.SUCCESS
|
|
|
) {
|
|
) {
|
|
|
- console.log('资源订阅失败 ->', subscribeRes.code)
|
|
|
|
|
|
|
+ console.log("资源订阅失败 ->", subscribeRes.code);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onTrackUnpublish(tracks: RTC.RCRemoteTrack[]) {
|
|
onTrackUnpublish(tracks: RTC.RCRemoteTrack[]) {
|
|
|
- console.log(tracks)
|
|
|
|
|
- event.emit(LIVE_EVENT_MESSAGE['RM:RTC:TrackUnpublish'], tracks)
|
|
|
|
|
|
|
+ event.emit(LIVE_EVENT_MESSAGE["RM:RTC:TrackUnpublish"], tracks);
|
|
|
},
|
|
},
|
|
|
onSwitchRole(userId: string, role: RTC.RCRTCLiveRole) {
|
|
onSwitchRole(userId: string, role: RTC.RCRTCLiveRole) {
|
|
|
- event.emit(LIVE_EVENT_MESSAGE['RM:RTC:SwitchRole'], {
|
|
|
|
|
|
|
+ event.emit(LIVE_EVENT_MESSAGE["RM:RTC:SwitchRole"], {
|
|
|
userId,
|
|
userId,
|
|
|
role,
|
|
role,
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- onTrackReady(track: RTC.RCRemoteTrack) {
|
|
|
|
|
|
|
+ async onTrackReady(track: RTC.RCRemoteTrack) {
|
|
|
if (track.isAudioTrack()) {
|
|
if (track.isAudioTrack()) {
|
|
|
// 音轨不需要传递播放控件
|
|
// 音轨不需要传递播放控件
|
|
|
- track.play()
|
|
|
|
|
- const userId = track.getUserId()
|
|
|
|
|
|
|
+ track.play();
|
|
|
|
|
+ const userId = track.getUserId();
|
|
|
|
|
+
|
|
|
|
|
+ // 当流变化时,更新连麦用户列表
|
|
|
|
|
+ const joinUser = runtimeModel.joinList[userId];
|
|
|
|
|
+ console.log(joinUser, "joinUser");
|
|
|
|
|
+ if (!joinUser) {
|
|
|
|
|
+ console.log(runtimeModel.lookList, "runtimeModel.lookList");
|
|
|
|
|
+ const userInfo = runtimeModel.lookList[userId];
|
|
|
|
|
+ const list = userInfo
|
|
|
|
|
+ ? userInfo
|
|
|
|
|
+ : await _this.FetchUserDetails([userId]);
|
|
|
|
|
+ console.log(list, "list");
|
|
|
|
|
+ }
|
|
|
|
|
+ // if (runtimeModel.joinList || runtimeModel.lookList) {
|
|
|
|
|
+
|
|
|
|
|
+ // }
|
|
|
const trackUser = initAudioUsers.find(
|
|
const trackUser = initAudioUsers.find(
|
|
|
(user: any) => user.userId == Number(userId)
|
|
(user: any) => user.userId == Number(userId)
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
// console.log(trackUser, initAudioUsers, userId)
|
|
// console.log(trackUser, initAudioUsers, userId)
|
|
|
if (trackUser) {
|
|
if (trackUser) {
|
|
|
runtimeModel.joinList[userId] = {
|
|
runtimeModel.joinList[userId] = {
|
|
@@ -188,64 +206,67 @@ export default defineComponent({
|
|
|
id: userId,
|
|
id: userId,
|
|
|
name: trackUser.userName,
|
|
name: trackUser.userName,
|
|
|
userRoomType: 4,
|
|
userRoomType: 4,
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+ initAudioUsers = initAudioUsers.filter(
|
|
|
|
|
+ (user: any) => user.userId != Number(userId)
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onUserJoin(userIds: string[]) {
|
|
onUserJoin(userIds: string[]) {
|
|
|
- console.log('onUserJoin', userIds)
|
|
|
|
|
|
|
+ console.log("onUserJoin", userIds);
|
|
|
},
|
|
},
|
|
|
onUserLeave(userIds: string[]) {
|
|
onUserLeave(userIds: string[]) {
|
|
|
- event.emit(LIVE_EVENT_MESSAGE['RM:RTC:UserLeave'], userIds)
|
|
|
|
|
- console.log('onUserLeave', userIds)
|
|
|
|
|
|
|
+ event.emit(LIVE_EVENT_MESSAGE["RM:RTC:UserLeave"], userIds);
|
|
|
|
|
+ console.log("onUserLeave", userIds);
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
// RuntimeUtils.sendMessage({}, 'Welcome')
|
|
// RuntimeUtils.sendMessage({}, 'Welcome')
|
|
|
- const userIds: string[] | undefined = join?.room?.getRemoteUserIds()
|
|
|
|
|
|
|
+ const userIds: string[] | undefined = join?.room?.getRemoteUserIds();
|
|
|
// console.log('userIds', userIds)
|
|
// console.log('userIds', userIds)
|
|
|
if (userIds && userIds.length) {
|
|
if (userIds && userIds.length) {
|
|
|
- const list = await this.FetchUserDetails(userIds)
|
|
|
|
|
- initAudioUsers.push(...list)
|
|
|
|
|
|
|
+ const list = await this.FetchUserDetails(userIds);
|
|
|
|
|
+ initAudioUsers.push(...list);
|
|
|
}
|
|
}
|
|
|
const remoteTracks: RTC.RCRemoteTrack[] | undefined =
|
|
const remoteTracks: RTC.RCRemoteTrack[] | undefined =
|
|
|
- join?.room?.getRemoteTracks()
|
|
|
|
|
|
|
+ join?.room?.getRemoteTracks();
|
|
|
if (remoteTracks) {
|
|
if (remoteTracks) {
|
|
|
- await join?.room?.subscribe(remoteTracks)
|
|
|
|
|
|
|
+ await join?.room?.subscribe(remoteTracks);
|
|
|
}
|
|
}
|
|
|
if (join.room && join.code === RTC.RCRTCCode.SUCCESS) {
|
|
if (join.room && join.code === RTC.RCRTCCode.SUCCESS) {
|
|
|
- runtime.joinedRoom = join.room
|
|
|
|
|
|
|
+ runtime.joinedRoom = join.room;
|
|
|
join.room.registerReportListener({
|
|
join.room.registerReportListener({
|
|
|
onStateReport(report) {
|
|
onStateReport(report) {
|
|
|
- event.emit('onStateReport', report)
|
|
|
|
|
|
|
+ event.emit("onStateReport", report);
|
|
|
// console.log('onStateReport', report)
|
|
// console.log('onStateReport', report)
|
|
|
},
|
|
},
|
|
|
- })
|
|
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
if (isLiveing) {
|
|
if (isLiveing) {
|
|
|
- await RuntimeUtils.startLive(false)
|
|
|
|
|
- runtime.videoStatus = 'liveing'
|
|
|
|
|
|
|
+ await RuntimeUtils.startLive(false);
|
|
|
|
|
+ runtime.videoStatus = "liveing";
|
|
|
} else {
|
|
} else {
|
|
|
- await RuntimeUtils.setTrack([cameraVideoTrack], 'camera', false)
|
|
|
|
|
|
|
+ await RuntimeUtils.setTrack([cameraVideoTrack], "camera", false);
|
|
|
await RuntimeUtils.setTrack(
|
|
await RuntimeUtils.setTrack(
|
|
|
[microphoneAudioTrack],
|
|
[microphoneAudioTrack],
|
|
|
- 'microphone',
|
|
|
|
|
|
|
+ "microphone",
|
|
|
false
|
|
false
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
- const volume = localStorage.getItem(RuntimeUtils.AUDIO_DEVICE_VOLUME)
|
|
|
|
|
|
|
+ const volume = localStorage.getItem(RuntimeUtils.AUDIO_DEVICE_VOLUME);
|
|
|
if (volume) {
|
|
if (volume) {
|
|
|
- ActionBarRuntime.volume = parseInt(volume)
|
|
|
|
|
- RuntimeUtils.setVolume(parseInt(volume))
|
|
|
|
|
|
|
+ ActionBarRuntime.volume = parseInt(volume);
|
|
|
|
|
+ RuntimeUtils.setVolume(parseInt(volume));
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- runtime.videoStatus = 'error'
|
|
|
|
|
- console.log(error)
|
|
|
|
|
|
|
+ runtime.videoStatus = "error";
|
|
|
|
|
+ console.log(error);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
closeLive() {
|
|
closeLive() {
|
|
|
// removeMedia(runtime.mediaStreams, runtime.mediaStreamTrack)
|
|
// removeMedia(runtime.mediaStreams, runtime.mediaStreamTrack)
|
|
|
- runtime.videoStatus = 'stream'
|
|
|
|
|
|
|
+ runtime.videoStatus = "stream";
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
render() {
|
|
render() {
|
|
@@ -256,18 +277,18 @@ export default defineComponent({
|
|
|
<Header
|
|
<Header
|
|
|
class={[
|
|
class={[
|
|
|
styles.headerContent,
|
|
styles.headerContent,
|
|
|
- this.headerStatus ? styles['header-top'] : null,
|
|
|
|
|
|
|
+ this.headerStatus ? styles["header-top"] : null,
|
|
|
]}
|
|
]}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
<div class={styles.video}>
|
|
<div class={styles.video}>
|
|
|
<video ref={videoRef}></video>
|
|
<video ref={videoRef}></video>
|
|
|
{!runtime.screenShareStatus ? <VideoStatus /> : null}
|
|
{!runtime.screenShareStatus ? <VideoStatus /> : null}
|
|
|
- {runtime.videoStatus === 'liveing' ? <Chronography /> : null}
|
|
|
|
|
|
|
+ {runtime.videoStatus === "liveing" ? <Chronography /> : null}
|
|
|
</div>
|
|
</div>
|
|
|
<ActionBar />
|
|
<ActionBar />
|
|
|
{/* <div>video: {runtime.videoStatus}, imStatus: {runtime.imConnectStatus}</div> */}
|
|
{/* <div>video: {runtime.videoStatus}, imStatus: {runtime.imConnectStatus}</div> */}
|
|
|
</div>
|
|
</div>
|
|
|
- )
|
|
|
|
|
|
|
+ );
|
|
|
},
|
|
},
|
|
|
-})
|
|
|
|
|
|
|
+});
|