|
|
|
@ -14,33 +14,47 @@ import Peers from './Peers';
|
|
|
|
|
import Stats from './Stats';
|
|
|
|
|
import Notifications from './Notifications';
|
|
|
|
|
import NetworkThrottle from './NetworkThrottle';
|
|
|
|
|
import { log } from 'gulp-util';
|
|
|
|
|
import UrlParse from 'url-parse';
|
|
|
|
|
|
|
|
|
|
class Room extends React.Component
|
|
|
|
|
{
|
|
|
|
|
render()
|
|
|
|
|
{
|
|
|
|
|
class Room extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
const {
|
|
|
|
|
roomClient,
|
|
|
|
|
room,
|
|
|
|
|
me,
|
|
|
|
|
amActiveSpeaker,
|
|
|
|
|
onRoomLinkCopy
|
|
|
|
|
} = this.props;
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
const mediasoupClientVersion = room.mediasoupClientVersion === '__MEDIASOUP_CLIENT_VERSION__'
|
|
|
|
|
? 'dev'
|
|
|
|
|
: room.mediasoupClientVersion;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const urlParser = new UrlParse(window.location.href, true);
|
|
|
|
|
// 将字符串按 & 分隔
|
|
|
|
|
const parts = urlParser.href.split('&');
|
|
|
|
|
// 提取并解析每个部分
|
|
|
|
|
const params = parts.slice(1).reduce((acc, part) => {
|
|
|
|
|
const [key, value] = part.split('=');
|
|
|
|
|
if (key && value) acc[key] = value;
|
|
|
|
|
return acc;
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
let roomId = params['roomId'];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Appear duration={300}>
|
|
|
|
|
<div data-component='Room'>
|
|
|
|
|
<div className='crumbs'>
|
|
|
|
|
<span className='goback' onClick={() => {
|
|
|
|
|
|
|
|
|
|
// 向主页面发送消息请求返回主页面
|
|
|
|
|
window.parent.postMessage('goBack', '*');
|
|
|
|
|
}}>
|
|
|
|
|
值班专家<span style={{margin: '0 4px'}}>{`>`}</span>
|
|
|
|
|
值班专家<span style={{ margin: '0 4px' }}>{`>`}</span>
|
|
|
|
|
</span>
|
|
|
|
|
<span style={{color: '#5F6368'}}>在线聊天</span>
|
|
|
|
|
<span style={{ color: '#5F6368' }}>在线聊天</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Notifications />
|
|
|
|
@ -93,7 +107,7 @@ class Room extends React.Component
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className={classnames('me-container', {
|
|
|
|
|
'active-speaker' : amActiveSpeaker
|
|
|
|
|
'active-speaker': amActiveSpeaker
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<Me />
|
|
|
|
@ -106,12 +120,11 @@ class Room extends React.Component
|
|
|
|
|
<div className='sidebar'>
|
|
|
|
|
<div
|
|
|
|
|
className={classnames('button', 'hide-videos', {
|
|
|
|
|
on : me.audioOnly,
|
|
|
|
|
disabled : me.audioOnlyInProgress
|
|
|
|
|
on: me.audioOnly,
|
|
|
|
|
disabled: me.audioOnlyInProgress
|
|
|
|
|
})}
|
|
|
|
|
data-tip={'将参与者的视频 显示/隐藏'}
|
|
|
|
|
onClick={() =>
|
|
|
|
|
{
|
|
|
|
|
onClick={() => {
|
|
|
|
|
me.audioOnly
|
|
|
|
|
? roomClient.disableAudioOnly()
|
|
|
|
|
: roomClient.enableAudioOnly();
|
|
|
|
@ -120,11 +133,10 @@ class Room extends React.Component
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className={classnames('button', 'mute-audio', {
|
|
|
|
|
on : me.audioMuted
|
|
|
|
|
on: me.audioMuted
|
|
|
|
|
})}
|
|
|
|
|
data-tip={'将参与者的音频 静音/取消静音'}
|
|
|
|
|
onClick={() =>
|
|
|
|
|
{
|
|
|
|
|
onClick={() => {
|
|
|
|
|
me.audioMuted
|
|
|
|
|
? roomClient.unmuteAudio()
|
|
|
|
|
: roomClient.muteAudio();
|
|
|
|
@ -133,13 +145,13 @@ class Room extends React.Component
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
className={classnames('button', 'restart-ice', {
|
|
|
|
|
disabled : me.restartIceInProgress
|
|
|
|
|
disabled: me.restartIceInProgress
|
|
|
|
|
})}
|
|
|
|
|
data-tip='重新启动 ICE'
|
|
|
|
|
onClick={() => roomClient.restartIce()}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* 当前房间状态信息 */}
|
|
|
|
|
{/* <Stats /> */}
|
|
|
|
|
|
|
|
|
@ -161,9 +173,8 @@ class Room extends React.Component
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount()
|
|
|
|
|
{
|
|
|
|
|
const { roomClient } = this.props;
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
const { roomClient } = this.props;
|
|
|
|
|
|
|
|
|
|
roomClient.join();
|
|
|
|
|
}
|
|
|
|
@ -171,30 +182,27 @@ class Room extends React.Component
|
|
|
|
|
|
|
|
|
|
Room.propTypes =
|
|
|
|
|
{
|
|
|
|
|
roomClient : PropTypes.any.isRequired,
|
|
|
|
|
room : appPropTypes.Room.isRequired,
|
|
|
|
|
me : appPropTypes.Me.isRequired,
|
|
|
|
|
amActiveSpeaker : PropTypes.bool.isRequired,
|
|
|
|
|
onRoomLinkCopy : PropTypes.func.isRequired
|
|
|
|
|
roomClient: PropTypes.any.isRequired,
|
|
|
|
|
room: appPropTypes.Room.isRequired,
|
|
|
|
|
me: appPropTypes.Me.isRequired,
|
|
|
|
|
amActiveSpeaker: PropTypes.bool.isRequired,
|
|
|
|
|
onRoomLinkCopy: PropTypes.func.isRequired
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) =>
|
|
|
|
|
{
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
|
return {
|
|
|
|
|
room : state.room,
|
|
|
|
|
me : state.me,
|
|
|
|
|
amActiveSpeaker : state.me.id === state.room.activeSpeakerId
|
|
|
|
|
room: state.room,
|
|
|
|
|
me: state.me,
|
|
|
|
|
amActiveSpeaker: state.me.id === state.room.activeSpeakerId
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) =>
|
|
|
|
|
{
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
|
return {
|
|
|
|
|
onRoomLinkCopy : () =>
|
|
|
|
|
{
|
|
|
|
|
onRoomLinkCopy: () => {
|
|
|
|
|
dispatch(requestActions.notify(
|
|
|
|
|
{
|
|
|
|
|
text : '房间链接已复制到剪贴板'
|
|
|
|
|
text: '房间链接已复制到剪贴板'
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|