diff --git a/app/lib/RoomClient.js b/app/lib/RoomClient.js index 85794c0..4599d03 100644 --- a/app/lib/RoomClient.js +++ b/app/lib/RoomClient.js @@ -269,7 +269,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'WebSocket connection failed' + text : 'WebSocket连接失败' })); }); @@ -278,7 +278,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'WebSocket disconnected' + text : 'WebSocket已断开连接' })); // Close mediasoup Transports. @@ -399,7 +399,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error creating a Consumer: ${error}` + text : `创建用户时出错: ${error}` })); throw error; @@ -468,7 +468,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'DataConsumer closed' + text : 'DataConsumer 已关闭' })); }); @@ -479,7 +479,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `DataConsumer error: ${error}` + text : `DataConsumer 错误: ${error}` })); }); @@ -543,6 +543,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { + type : 'userMessage', title : `${sendingPeer.displayName} says:`, text : message, timeout : 5000 @@ -587,7 +588,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error creating a DataConsumer: ${error}` + text : `创建DataConsumer时出错: ${error}` })); throw error; @@ -636,7 +637,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { - text : `${peer.displayName} has joined the room` + text : `${peer.displayName} 加入房间` })); break; @@ -859,7 +860,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'Microphone disconnected!' + text : '麦克风断开!' })); this.disableMic() @@ -873,7 +874,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error enabling microphone: ${error}` + text : `启用麦克风时出错: ${error}` })); if (track) @@ -903,7 +904,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error closing server-side mic Producer: ${error}` + text : `关闭服务器端麦克风生成器时出错: ${error}` })); } @@ -931,7 +932,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error pausing server-side mic Producer: ${error}` + text : `暂停服务器端麦克风生成器时出错: ${error}` })); } } @@ -957,7 +958,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error resuming server-side mic Producer: ${error}` + text : `恢复服务器端麦克风生成器时出错: ${error}` })); } } @@ -1148,7 +1149,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'Webcam disconnected!' + text : '网络摄像头已断开连接!' })); this.disableWebcam() @@ -1162,7 +1163,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error enabling webcam: ${error}` + text : `启用网络摄像头时出错: ${error}` })); if (track) @@ -1195,7 +1196,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error closing server-side webcam Producer: ${error}` + text : `关闭服务器端网络摄像头生成器时出错: ${error}` })); } @@ -1265,7 +1266,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Could not change webcam: ${error}` + text : `无法更改网络摄像头: ${error}` })); } @@ -1322,7 +1323,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Could not change webcam resolution: ${error}` + text : `无法更改网络摄像头分辨率: ${error}` })); } @@ -1517,7 +1518,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'Share disconnected!' + text : '共享已断开连接!' })); this.disableShare() @@ -1533,7 +1534,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error sharing: ${error}` + text : `共享错误: ${error}` })); } @@ -1567,7 +1568,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error closing server-side share Producer: ${error}` + text : `关闭服务器端共享生成器时出错: ${error}` })); } @@ -1674,7 +1675,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { - text : 'ICE restarted' + text : 'ICE 重新启动' })); } catch (error) @@ -1684,7 +1685,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `ICE restart failed: ${error}` + text : `ICE 重启失败: ${error}` })); } @@ -1710,7 +1711,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error setting max sending video spatial layer: ${error}` + text : `设置最大发送视频空间层时出错: ${error}` })); } } @@ -1736,7 +1737,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error setting Consumer preferred layers: ${error}` + text : `设置用户首选图层时出错: ${error}` })); } } @@ -1760,7 +1761,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error setting Consumer priority: ${error}` + text : `设置用户优先级时出错: ${error}` })); } } @@ -1775,7 +1776,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { - text : 'Keyframe requested for video consumer' + text : '为视频用户请求关键帧' })); } catch (error) @@ -1785,7 +1786,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error requesting key frame for Consumer: ${error}` + text : `为用户请求关键帧时出错: ${error}` })); } } @@ -1840,7 +1841,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'Chat DataProducer closed' + text : '聊天数据生成器已关闭' })); }); @@ -1851,7 +1852,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Chat DataProducer error: ${error}` + text : `聊天数据生成器错误: ${error}` })); }); @@ -1867,7 +1868,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error enabling chat DataProducer: ${error}` + text : `启用聊天数据生成器时出错: ${error}` })); throw error; @@ -1924,7 +1925,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'Bot DataProducer closed' + text : 'Bot DataProducer 已关闭' })); }); @@ -1935,7 +1936,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Bot DataProducer error: ${error}` + text : `Bot DataProducer 错误: ${error}` })); }); @@ -1951,7 +1952,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error enabling bot DataProducer: ${error}` + text : `启用bot DataProducter时出错: ${error}` })); throw error; @@ -1967,7 +1968,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : 'No chat DataProducer' + text : '无聊天 DataProducter' })); return; @@ -1984,7 +1985,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `chat DataProducer.send() failed: ${error}` + text : `聊天DataProducter.send()失败: ${error}` })); } } @@ -2038,7 +2039,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { - text : 'Display name changed' + text : '显示名称已更改' })); } catch (error) @@ -2048,7 +2049,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Could not change display name: ${error}` + text : `无法更改显示名称: ${error}` })); // We need to refresh the component for it to render the previous @@ -2225,7 +2226,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error applying network throttle: ${error}` + text : `应用网络节流时出错: ${error}` })); } } @@ -2247,7 +2248,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error resetting network throttle: ${error}` + text : `重置网络节流阀时出错: ${error}` })); } } @@ -2479,11 +2480,12 @@ export default class RoomClient store.dispatch( stateActions.removeAllNotifications()); - store.dispatch(requestActions.notify( - { - text : 'You are in the room!', - timeout : 3000 - })); + // store.dispatch(requestActions.notify( + // { + // isMe : true, + // text : '你已成功加入房间', + // timeout : 3000 + // })); for (const peer of peers) { @@ -2535,7 +2537,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Could not join the room: ${error}` + text : `无法加入房间: ${error}` })); this.close(); @@ -2614,7 +2616,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error pausing Consumer: ${error}` + text : `暂停用户时出错: ${error}` })); } } @@ -2640,7 +2642,7 @@ export default class RoomClient store.dispatch(requestActions.notify( { type : 'error', - text : `Error resuming Consumer: ${error}` + text : `恢复用户时出错: ${error}` })); } } diff --git a/app/lib/components/ChatInput.jsx b/app/lib/components/ChatInput.jsx index 626d6e4..6036a74 100644 --- a/app/lib/components/ChatInput.jsx +++ b/app/lib/components/ChatInput.jsx @@ -2,18 +2,17 @@ import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { withRoomContext } from '../RoomContext'; +import * as requestActions from '../redux/requestActions'; const BotMessageRegex = new RegExp('^@bot (.*)'); -class ChatInput extends React.Component -{ - constructor(props) - { +class ChatInput extends React.Component { + constructor(props) { super(props); this.state = { - text : '' + text: '' }; // TextArea element got via React ref. @@ -21,12 +20,12 @@ class ChatInput extends React.Component this._textareaElem = null; } - render() - { + render() { const { connected, chatDataProducer, - botDataProducer + botDataProducer, + sendUserInfo } = this.props; const { text } = this.state; @@ -37,27 +36,29 @@ class ChatInput extends React.Component