yangjie #47

Merged
yangqiang merged 49 commits from yangjie into master 2025-01-24 13:43:09 +08:00
2 changed files with 160 additions and 31 deletions
Showing only changes of commit 9b58afece8 - Show all commits

View File

@ -13,7 +13,7 @@ import ImageUrl from '@/utils/package/imageUrl'
import { agora } from '@/utils/package/agora' import { agora } from '@/utils/package/agora'
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import durationPlugin from 'dayjs/plugin/duration'; import durationPlugin from 'dayjs/plugin/duration';
import { AudioVolumeInfo, ConnectionChangedReasonType, ConnectionStateType, LocalVideoStreamReason, LocalVideoStreamState, QualityType, RtcConnection, RtcStats, UserOfflineReasonType, VideoSourceType, VideoStreamType } from 'agora-electron-sdk'; import { AudioVolumeInfo, ConnectionChangedReasonType, ConnectionStateType, LocalVideoStreamReason, LocalVideoStreamState, QualityType, RenderModeType, RtcConnection, RtcStats, UserOfflineReasonType, VideoSourceType, VideoStreamType } from 'agora-electron-sdk';
import Avatar from '@/components/Avatar'; import Avatar from '@/components/Avatar';
import SharedFilesModel from '@/components/SharedFilesModel'; import SharedFilesModel from '@/components/SharedFilesModel';
import StupWizard from '@/components/StupWizard'; import StupWizard from '@/components/StupWizard';
@ -184,6 +184,11 @@ const Meeting: React.FC = () => {
const [noViewChatList, setNoViewChatList] = useState(0) const [noViewChatList, setNoViewChatList] = useState(0)
const [currentLookUserAccount, setCurrentLookUserAccount] = useState<any>('') const [currentLookUserAccount, setCurrentLookUserAccount] = useState<any>('')
const [recorder, setRecorder] = useState<any>('') const [recorder, setRecorder] = useState<any>('')
const [contextMenu, setContextMenu] = useState<any>('')
const [contextMenuStyle, setContextMenuStyle] = useState({
top: 0,
left: 0,
})
const [_currentRequestSpeakType, setCurrentRequestSpeakType] = useState<'video' | 'audio' | ''>('') const [_currentRequestSpeakType, setCurrentRequestSpeakType] = useState<'video' | 'audio' | ''>('')
const [_mediaStream, setMediaStream] = useState<any>([]) const [_mediaStream, setMediaStream] = useState<any>([])
const [isShare, setIsShare] = useState<any>(null) const [isShare, setIsShare] = useState<any>(null)
@ -1110,6 +1115,7 @@ const Meeting: React.FC = () => {
view: document.getElementById(`video-${connection.localUid}`), view: document.getElementById(`video-${connection.localUid}`),
channelId: connection.channelId, channelId: connection.channelId,
sourceType: VideoSourceType.VideoSourceCameraPrimary, sourceType: VideoSourceType.VideoSourceCameraPrimary,
renderMode: RenderModeType.RenderModeFit
}) })
}, 1000); }, 1000);
getShowUser(); getShowUser();
@ -1126,6 +1132,7 @@ const Meeting: React.FC = () => {
uid: Number(remoteUid), uid: Number(remoteUid),
view: document.getElementById(`video-${remoteUid}`), view: document.getElementById(`video-${remoteUid}`),
channelId: connection.channelId, channelId: connection.channelId,
renderMode: RenderModeType.RenderModeFit
}) })
}, 1000); }, 1000);
} }
@ -1141,6 +1148,7 @@ const Meeting: React.FC = () => {
uid: Number(remoteUid), uid: Number(remoteUid),
view: null, view: null,
channelId: connection.channelId, channelId: connection.channelId,
renderMode: RenderModeType.RenderModeFit
}); });
} }
}, },
@ -1324,12 +1332,14 @@ const Meeting: React.FC = () => {
view: document.getElementById(`video-${userItem.uid}`), view: document.getElementById(`video-${userItem.uid}`),
channelId: state.channelId, channelId: state.channelId,
sourceType: VideoSourceType.VideoSourceCameraPrimary, sourceType: VideoSourceType.VideoSourceCameraPrimary,
renderMode: RenderModeType.RenderModeFit
}) })
} else { } else {
await agora.setupRemoteVideoJoin({ await agora.setupRemoteVideoJoin({
uid: Number(userItem.uid), uid: Number(userItem.uid),
view: document.getElementById(`video-${userItem.uid}`), view: document.getElementById(`video-${userItem.uid}`),
channelId: state.channelId, channelId: state.channelId,
renderMode: RenderModeType.RenderModeFit
}) })
} }
} }
@ -2251,7 +2261,9 @@ const Meeting: React.FC = () => {
} }
return ( return (
<> <>
<div className={styles.meeting}> <div className={styles.meeting} onClick={() => {
setContextMenu('')
}}>
{isScreenCapture ? <div className={`${styles.meetingAbsolute}`} id='meetingAbsoluteVideo'> {isScreenCapture ? <div className={`${styles.meetingAbsolute}`} id='meetingAbsoluteVideo'>
<div style={{ top: '0px' }} className={`${styles.meetingAbsoluteText}`}>{currentSpeakUser.length ? '正在说话:' + currentSpeakUser.join(';') : '正在说话:'}</div> <div style={{ top: '0px' }} className={`${styles.meetingAbsoluteText}`}>{currentSpeakUser.length ? '正在说话:' + currentSpeakUser.join(';') : '正在说话:'}</div>
{footerList[0][1].active ? <div className={styles.meetingAbsoluteLoading}> {footerList[0][1].active ? <div className={styles.meetingAbsoluteLoading}>
@ -2265,6 +2277,102 @@ const Meeting: React.FC = () => {
}) })
}}><span>{isExpand ? '展开' : '收起'}</span></div> }}><span>{isExpand ? '展开' : '收起'}</span></div>
</div> : null} </div> : null}
{contextMenu ? <div className={styles.meetingContentSwiperCardPopover} style={
{
backgroundColor: '#07090B',
position: 'absolute',
top: contextMenuStyle.top,
left: contextMenuStyle.left,
zIndex: 4,
padding: 5
}
}>
{contextMenu.isRoomManager || role.ID.includes(contextMenu.roleId) ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
setAllUserLook(contextMenu)
}}
>Ta</Button> : null}
{contextMenu.uid !== user.uid && !role.ID.includes(contextMenu.roleId) ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
if (contextMenu.isRoomManager) {
DeleteRoomManager({
roomId: state.roomId,
roomNum: state.channelId,
userId: contextMenu.uid
})
} else {
postRoomManager({
roomId: state.roomId,
roomNum: state.channelId,
userId: contextMenu.uid
})
}
}}
>{contextMenu.isRoomManager ? '取消发言' : '允许发言'}</Button> : null}
{contextMenu.isRoomManager ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
postOpenMicr(!contextMenu.enableMicr, contextMenu.uid)
}}
>{contextMenu.enableMicr ? '静音' : '解除静音'}</Button> : null}
{contextMenu.isRoomManager ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
postOpenCamera(!contextMenu.enableCamera, contextMenu.uid)
}}
>{contextMenu.enableCamera ? '关闭视频' : '打开视频'}</Button> : null}
{contextMenu.uid !== user.uid ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
equipmentManagement(contextMenu.uid, contextMenu.userName)
}}
></Button> : null}
{contextMenu.uid !== user.uid ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
userNameRef.current.changeModal({
userName: contextMenu.userName,
uid: contextMenu.uid
})
}}
></Button> : null}
{contextMenu.uid !== user.uid ? <Button
type="primary"
style={{ backgroundColor: '#EC3C3C' }}
size={'small'}
onClick={(event) => {
event.stopPropagation();
setContextMenu('')
getRoomKickout(state.channelId, contextMenu.uid, contextMenu.userName)
}}
></Button> : null}
</div> : null}
{contextHolder} {contextHolder}
<div className={styles.meetingHeader}> <div className={styles.meetingHeader}>
<div> <div>
@ -2371,6 +2479,15 @@ const Meeting: React.FC = () => {
renderVideo(item.uid) renderVideo(item.uid)
} }
}} }}
onContextMenu={(e: any) => {
if (role.ID.includes(contextMenu.roleId)) {
setContextMenuStyle({
top: e.clientY,
left: e.clientX,
})
setContextMenu(item)
}
}}
> >
<div className={`${styles.meetingContentSwiperCardVdeio} ${(item.uid === currentVideoId) && !isVideoFullScreen ? styles.active : ''} ${(role.ID.includes(item.roleId) || item.isRoomManager) && !isVideoFullScreen ? styles.boxShadow : ''}`} id={`video-${item.uid}`}> <div className={`${styles.meetingContentSwiperCardVdeio} ${(item.uid === currentVideoId) && !isVideoFullScreen ? styles.active : ''} ${(role.ID.includes(item.roleId) || item.isRoomManager) && !isVideoFullScreen ? styles.boxShadow : ''}`} id={`video-${item.uid}`}>
<div className={styles.meetingContentSwiperCardVdeioLoading}> <div className={styles.meetingContentSwiperCardVdeioLoading}>
@ -2436,10 +2553,23 @@ const Meeting: React.FC = () => {
type="primary" type="primary"
className='m-ant-btn' className='m-ant-btn'
size={'small'} size={'small'}
onClick={() => { onClick={(event) => {
event.stopPropagation();
equipmentManagement(item.uid, item.userName) equipmentManagement(item.uid, item.userName)
}} }}
></Button> : null} ></Button> : null}
{item.uid !== user.uid ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={(event) => {
event.stopPropagation();
userNameRef.current.changeModal({
userName: item.userName,
uid: item.uid
})
}}
></Button> : null}
{item.uid !== user.uid ? <Button {item.uid !== user.uid ? <Button
type="primary" type="primary"
style={{ backgroundColor: '#EC3C3C' }} style={{ backgroundColor: '#EC3C3C' }}
@ -2449,17 +2579,6 @@ const Meeting: React.FC = () => {
getRoomKickout(state.channelId, item.uid, item.userName) getRoomKickout(state.channelId, item.uid, item.userName)
}} }}
></Button> : null} ></Button> : null}
{item.uid !== user.uid ? <Button
type="primary"
className='m-ant-btn'
size={'small'}
onClick={() => {
userNameRef.current.changeModal({
userName: item.userName,
uid: item.uid
})
}}
></Button> : null}
</div> </div>
}> }>
<div className={styles.meetingContentOperation}> <div className={styles.meetingContentOperation}>
@ -2602,22 +2721,23 @@ const Meeting: React.FC = () => {
<Popover placement="left" title={''} content={ <Popover placement="left" title={''} content={
<div style={{ width: '100px' }}> <div style={{ width: '100px' }}>
<Button <Button
style={{ width: '100%' }}
type="primary" type="primary"
className='m-ant-btn' className='m-ant-btn'
style={{ width: '100%' }} size={'small'}
onClick={() => {
setAllUserLook(item)
}}
>Ta</Button>
<Button
type="primary"
className='m-ant-btn'
style={{ width: '100%', marginTop: '10px' }}
size={'small'} size={'small'}
onClick={() => { onClick={() => {
equipmentManagement(item.uid, item.userName) equipmentManagement(item.uid, item.userName)
}} }}
></Button> ></Button>
<Button
type="primary"
style={{ backgroundColor: '#EC3C3C', width: '100%', marginTop: '10px' }}
size={'small'}
onClick={() => {
getRoomKickout(state.channelId, item.uid, item.userName)
}}
></Button>
<Button <Button
type="primary" type="primary"
className='m-ant-btn' className='m-ant-btn'
@ -2630,6 +2750,14 @@ const Meeting: React.FC = () => {
}) })
}} }}
></Button> ></Button>
<Button
type="primary"
style={{ backgroundColor: '#EC3C3C', width: '100%', marginTop: '10px' }}
size={'small'}
onClick={() => {
getRoomKickout(state.channelId, item.uid, item.userName)
}}
></Button>
</div> </div>
}> }>
<EllipsisOutlined style={{ color: '#fff', fontSize: '20px' }} /> <EllipsisOutlined style={{ color: '#fff', fontSize: '20px' }} />
@ -2774,7 +2902,8 @@ const Meeting: React.FC = () => {
type="primary" type="primary"
className='m-ant-btn' className='m-ant-btn'
size={'small'} size={'small'}
onClick={() => { onClick={(event) => {
event.stopPropagation();
equipmentManagement(roomUserItem.uid, roomUserItem.userName) equipmentManagement(roomUserItem.uid, roomUserItem.userName)
}} }}
></Button> : null} ></Button> : null}

View File

@ -219,7 +219,7 @@ export const agora = {
if (String(uid).length === 9) { if (String(uid).length === 9) {
return RenderModeType.RenderModeFit return RenderModeType.RenderModeFit
} else { } else {
return RenderModeType.RenderModeFit return RenderModeType.RenderModeHidden
} }
}, },
// 本地加入 // 本地加入
@ -229,7 +229,7 @@ export const agora = {
return return
} }
await rtcEngine.setupLocalVideo({ await rtcEngine.setupLocalVideo({
renderMode: agora.getRrenderMode(item.uid), renderMode: item.renderMode || agora.getRrenderMode(item.uid),
sourceType: item.sourceType, sourceType: item.sourceType,
uid: item.uid, uid: item.uid,
view: item.view, view: item.view,
@ -242,7 +242,7 @@ export const agora = {
if (item.view?.childNodes.length === 1) { if (item.view?.childNodes.length === 1) {
await rtcEngine.setupRemoteVideo( await rtcEngine.setupRemoteVideo(
{ {
renderMode: agora.getRrenderMode(item.uid), renderMode: item.renderMode || agora.getRrenderMode(item.uid),
sourceType: VideoSourceType.VideoSourceRemote, sourceType: VideoSourceType.VideoSourceRemote,
uid: item.uid, uid: item.uid,
view: item.view, view: item.view,
@ -256,7 +256,7 @@ export const agora = {
if (item.view?.childNodes.length === 1) { if (item.view?.childNodes.length === 1) {
await rtcEngine.setupRemoteVideoEx( await rtcEngine.setupRemoteVideoEx(
{ {
renderMode: agora.getRrenderMode(item.uid), renderMode: item.renderMode || agora.getRrenderMode(item.uid),
sourceType: VideoSourceType.VideoSourceRemote, sourceType: VideoSourceType.VideoSourceRemote,
uid: item.uid, uid: item.uid,
view: item.view, view: item.view,
@ -270,7 +270,7 @@ export const agora = {
setupRemoteVideo: async (item: any) => { setupRemoteVideo: async (item: any) => {
await rtcEngine.setupRemoteVideo( await rtcEngine.setupRemoteVideo(
{ {
renderMode: agora.getRrenderMode(item.uid), renderMode: item.renderMode || agora.getRrenderMode(item.uid),
sourceType: VideoSourceType.VideoSourceRemote, sourceType: VideoSourceType.VideoSourceRemote,
uid: item.uid, uid: item.uid,
view: item.view, view: item.view,