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