yangjie #28
|
|
@ -11,14 +11,9 @@ const fs = require('fs').promises;
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
const StupWizard = forwardRef((_props: any, ref: any) => {
|
const StupWizard = forwardRef((_props: any, ref: any) => {
|
||||||
useImperativeHandle(ref, () => ({
|
useImperativeHandle(ref, () => ({
|
||||||
changeModal: (index: number = 0, data: any) => {
|
changeModal: (index: number = 0) => {
|
||||||
if (location.hash.indexOf('/meeting') === -1) {
|
if (location.hash.indexOf('/meeting') === -1) {
|
||||||
agora.init()
|
agora.init()
|
||||||
} else {
|
|
||||||
agora.muteLocalAudioStream(true)
|
|
||||||
}
|
|
||||||
if (data) {
|
|
||||||
setIsMuteLocalAudioStream(data.active)
|
|
||||||
}
|
}
|
||||||
setList((res: any) => {
|
setList((res: any) => {
|
||||||
res.forEach((item: any) => {
|
res.forEach((item: any) => {
|
||||||
|
|
@ -63,7 +58,6 @@ const StupWizard = forwardRef((_props: any, ref: any) => {
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
const [isStupWizard, setIsStupWizard] = useState(false);
|
const [isStupWizard, setIsStupWizard] = useState(false);
|
||||||
const [isMuteLocalAudioStream, setIsMuteLocalAudioStream] = useState(true);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Modal
|
<Modal
|
||||||
|
|
@ -104,8 +98,6 @@ const StupWizard = forwardRef((_props: any, ref: any) => {
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
if (location.hash.indexOf('/meeting') === -1) {
|
if (location.hash.indexOf('/meeting') === -1) {
|
||||||
agora.release()
|
agora.release()
|
||||||
} else {
|
|
||||||
agora.muteLocalAudioStream(!isMuteLocalAudioStream)
|
|
||||||
}
|
}
|
||||||
setIsStupWizard(false)
|
setIsStupWizard(false)
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -928,8 +928,7 @@ const Meeting: React.FC = () => {
|
||||||
// 声网初始化
|
// 声网初始化
|
||||||
const agoraInit = async () => {
|
const agoraInit = async () => {
|
||||||
await agora.init(true)
|
await agora.init(true)
|
||||||
await agora.muteLocalAudioStream(state.enableMicr)
|
await agora.muteLocalVideoStream(userInfo, state.enableMicr, state.enableCamera)
|
||||||
await agora.muteLocalVideoStream(state.enableCamera)
|
|
||||||
await getJoin(state.enableMicr, state.enableCamera)
|
await getJoin(state.enableMicr, state.enableCamera)
|
||||||
agora.registerEventHandler({
|
agora.registerEventHandler({
|
||||||
onJoinChannelSuccess: async (connection: RtcConnection, _elapsed: number) => {
|
onJoinChannelSuccess: async (connection: RtcConnection, _elapsed: number) => {
|
||||||
|
|
@ -1071,27 +1070,31 @@ const Meeting: React.FC = () => {
|
||||||
if (item.uid === userInfo.uid) {
|
if (item.uid === userInfo.uid) {
|
||||||
const footerListTemplate = [...footerList]
|
const footerListTemplate = [...footerList]
|
||||||
await agora.getVideoDeviceManager().then(async (res) => {
|
await agora.getVideoDeviceManager().then(async (res) => {
|
||||||
|
getUserRoomInfo().then(async (r) => {
|
||||||
if (res.list.length) {
|
if (res.list.length) {
|
||||||
footerListTemplate[0][1].title = item.enableCamera ? '关闭视频' : '开启视频'
|
footerListTemplate[0][1].title = item.enableCamera ? '关闭视频' : '开启视频'
|
||||||
footerListTemplate[0][1].active = !item.enableCamera
|
footerListTemplate[0][1].active = !item.enableCamera
|
||||||
await agora.muteLocalVideoStream(item.enableCamera)
|
await agora.muteLocalVideoStream(r, item.enableMicr, item.enableCamera)
|
||||||
} else {
|
} else {
|
||||||
footerListTemplate[0][1].title = '开启视频'
|
footerListTemplate[0][1].title = '开启视频'
|
||||||
footerListTemplate[0][1].active = true
|
footerListTemplate[0][1].active = true
|
||||||
await agora.muteLocalVideoStream(false)
|
await agora.muteLocalVideoStream(r, item.enableMicr, false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
await agora.getAudioMediaList().then(async (res) => {
|
await agora.getAudioMediaList().then(async (res) => {
|
||||||
|
getUserRoomInfo().then(async (r) => {
|
||||||
if (res.ecordingList.length) {
|
if (res.ecordingList.length) {
|
||||||
footerListTemplate[0][0].title = item.enableMicr ? '静音' : '解除静音'
|
footerListTemplate[0][0].title = item.enableMicr ? '静音' : '解除静音'
|
||||||
footerListTemplate[0][0].active = !item.enableMicr
|
footerListTemplate[0][0].active = !item.enableMicr
|
||||||
await agora.muteLocalAudioStream(item.enableMicr)
|
await agora.muteLocalAudioStream(r, item.enableMicr, item.enableCamera)
|
||||||
} else {
|
} else {
|
||||||
footerListTemplate[0][0].title = '解除静音'
|
footerListTemplate[0][0].title = '解除静音'
|
||||||
footerListTemplate[0][0].active = true
|
footerListTemplate[0][0].active = true
|
||||||
await agora.muteLocalAudioStream(false)
|
await agora.muteLocalAudioStream(r, false, item.enableCamera)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
})
|
||||||
if (!role.ID.includes(userInfo.roleId)) {
|
if (!role.ID.includes(userInfo.roleId)) {
|
||||||
if (item.isRoomManager) {
|
if (item.isRoomManager) {
|
||||||
footerListTemplate[0][2].title = '结束发言'
|
footerListTemplate[0][2].title = '结束发言'
|
||||||
|
|
@ -1423,7 +1426,7 @@ const Meeting: React.FC = () => {
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case '设置':
|
case '设置':
|
||||||
stupWizardRef.current.changeModal(0, footerList[0][0])
|
stupWizardRef.current.changeModal()
|
||||||
break;
|
break;
|
||||||
case '邀请人员':
|
case '邀请人员':
|
||||||
await getUserRoomInfo().then(async (res) => {
|
await getUserRoomInfo().then(async (res) => {
|
||||||
|
|
|
||||||
|
|
@ -380,17 +380,27 @@ export const agora = {
|
||||||
rtcEngine.enableLoopbackRecording(false)
|
rtcEngine.enableLoopbackRecording(false)
|
||||||
},
|
},
|
||||||
// 取消或恢复发布本地音频流
|
// 取消或恢复发布本地音频流
|
||||||
muteLocalAudioStream: async (publishMicrophoneTrack: boolean) => {
|
muteLocalAudioStream: async (data: any, publishMicrophoneTrack: boolean, publishCameraTrack: boolean) => {
|
||||||
// await rtcEngine.muteLocalAudioStream(mute)
|
// await rtcEngine.muteLocalAudioStream(mute)
|
||||||
await rtcEngine.updateChannelMediaOptions({
|
await rtcEngine.updateChannelMediaOptions({
|
||||||
publishMicrophoneTrack,//设置是否发布麦克风采集到的音频
|
clientRoleType: data ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
|
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
||||||
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
|
publishMicrophoneTrack: publishMicrophoneTrack,//设置是否发布麦克风采集到的音频
|
||||||
|
publishCameraTrack: publishCameraTrack,//设置是否发布摄像头采集的视频
|
||||||
|
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 取消或恢复发布本地视频流
|
// 取消或恢复发布本地视频流
|
||||||
muteLocalVideoStream: async (publishCameraTrack: boolean) => {
|
muteLocalVideoStream: async (data: any, publishMicrophoneTrack: boolean, publishCameraTrack: boolean) => {
|
||||||
// await rtcEngine.muteLocalVideoStream(mute)
|
// await rtcEngine.muteLocalVideoStream(mute)
|
||||||
await rtcEngine.updateChannelMediaOptions({
|
await rtcEngine.updateChannelMediaOptions({
|
||||||
publishCameraTrack,//设置是否发布摄像头采集的视频
|
clientRoleType: data ? ClientRoleType.ClientRoleBroadcaster : ClientRoleType.ClientRoleAudience, //用户角色 ClientRoleBroadcaster 主播 ClientRoleAudience 观众
|
||||||
|
autoSubscribeAudio: true,//设置是否自动订阅所有音频流
|
||||||
|
autoSubscribeVideo: true,//设置是否自动订阅所有视频流
|
||||||
|
publishMicrophoneTrack: publishMicrophoneTrack,//设置是否发布麦克风采集到的音频
|
||||||
|
publishCameraTrack: publishCameraTrack,//设置是否发布摄像头采集的视频
|
||||||
|
publishScreenTrack: false,//设置是否发布屏幕采集的视频
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 摄像头采集
|
// 摄像头采集
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue