关闭声音视频

This commit is contained in:
yj 2024-07-15 16:34:53 +08:00
parent 09ea5547a5
commit b2df36b061
3 changed files with 61 additions and 7 deletions

View File

@ -157,6 +157,7 @@
bottom: 10px; bottom: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
z-index: 2;
.meetingContentUserRole { .meetingContentUserRole {
background: #FDC229; background: #FDC229;
@ -191,6 +192,21 @@
} }
} }
} }
.meetingContentError {
position: absolute;
justify-content: center;
display: flex;
align-items: center;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
background-color: black;
color: white;
font-size: 20px;
}
} }
.meetingContentBodyRight { .meetingContentBodyRight {

View File

@ -207,24 +207,48 @@ const Meeting: React.FC = () => {
footerListTemplate[itemIndex][rowIndex].active = true footerListTemplate[itemIndex][rowIndex].active = true
setFooterList(footerListTemplate) setFooterList(footerListTemplate)
agora.muteLocalAudioStream(true) agora.muteLocalAudioStream(true)
await onInvoke('joinChannel', {
roomNum: state.channelId,
isMute: false,
isCloseCamera: true
})
getRoomUser()
break; break;
case '开启声音': case '开启声音':
footerListTemplate[itemIndex][rowIndex].title = '关闭声音' footerListTemplate[itemIndex][rowIndex].title = '关闭声音'
footerListTemplate[itemIndex][rowIndex].active = false footerListTemplate[itemIndex][rowIndex].active = false
setFooterList(footerListTemplate) setFooterList(footerListTemplate)
agora.muteLocalAudioStream(false) agora.muteLocalAudioStream(false)
await onInvoke('joinChannel', {
roomNum: state.channelId,
isMute: true,
isCloseCamera: true
})
getRoomUser()
break; break;
case '关闭视频': case '关闭视频':
footerListTemplate[itemIndex][rowIndex].title = '开启视频' footerListTemplate[itemIndex][rowIndex].title = '开启视频'
footerListTemplate[itemIndex][rowIndex].active = true footerListTemplate[itemIndex][rowIndex].active = true
setFooterList(footerListTemplate) setFooterList(footerListTemplate)
agora.muteLocalVideoStream(true) agora.muteLocalVideoStream(true)
await onInvoke('joinChannel', {
roomNum: state.channelId,
isMute: true,
isCloseCamera: false
})
getRoomUser()
break; break;
case '开启视频': case '开启视频':
footerListTemplate[itemIndex][rowIndex].title = '关闭视频' footerListTemplate[itemIndex][rowIndex].title = '关闭视频'
footerListTemplate[itemIndex][rowIndex].active = false footerListTemplate[itemIndex][rowIndex].active = false
setFooterList(footerListTemplate) setFooterList(footerListTemplate)
agora.muteLocalVideoStream(false) agora.muteLocalVideoStream(false)
await onInvoke('joinChannel', {
roomNum: state.channelId,
isMute: true,
isCloseCamera: true
})
getRoomUser()
break; break;
case '设置向导': case '设置向导':
stupWizardRef.current.changeIsStupWizard() stupWizardRef.current.changeIsStupWizard()
@ -309,11 +333,13 @@ const Meeting: React.FC = () => {
}) })
} }
const handleCustomStorageChange = (e: any): void => { const handleCustomStorageChange = async (e: any): Promise<void> => {
if (e.key === 'isJoin') { if (e.key === 'isJoin') {
if (e.value) { if (e.value) {
onInvoke('joinChannel', { await onInvoke('joinChannel', {
roomNum: state.channelId roomNum: state.channelId,
isMute: true,
isCloseCamera: true
}) })
getRoomUser() getRoomUser()
} else { } else {
@ -381,6 +407,7 @@ const Meeting: React.FC = () => {
</div> </div>
</div> </div>
{meetingContentUser(item)} {meetingContentUser(item)}
{item.isCloseCamera ? null : meetingContentError()}
</div> </div>
)} )}
</div> </div>
@ -705,12 +732,21 @@ const meetingContentUser = (item: any) => {
<img src={ImageUrl.icon32} alt="" /> <img src={ImageUrl.icon32} alt="" />
</div> : null} </div> : null}
<div className={styles.meetingContentUserName}> <div className={styles.meetingContentUserName}>
<img src={ImageUrl.icon22} alt="" /> <img src={item.isMute ? ImageUrl.icon22 : ImageUrl.icon22Active} alt="" />
<span>{item.userName}</span> <span>{item.userName}</span>
</div> </div>
</div> </div>
</> </>
) )
} }
const meetingContentError = () => {
return (
<>
<div className={styles.meetingContentError}>
</div>
</>
)
}
export default Meeting export default Meeting

View File

@ -23,14 +23,16 @@ export const onSignalr = (callBack: Function) => {
}) })
}); });
} }
export const onInvoke = (str: string, data: any) => { export const onInvoke = async (str: string, data: any) => {
switch (str) { switch (str) {
case 'joinChannel': case 'joinChannel':
await connection.invoke(str, data.roomNum, data.isMute, data.isCloseCamera)
break;
case 'levelChannel': case 'levelChannel':
connection.invoke(str, data.roomNum) await connection.invoke(str, data.roomNum)
break; break;
case 'sendChannelMsg': case 'sendChannelMsg':
connection.invoke(str, data.roomNum, data.msg) await connection.invoke(str, data.roomNum, data.msg)
break; break;
} }
} }