Remaining code review items.
This commit is contained in:
@@ -149,15 +149,15 @@ export default class CallPanel extends React.PureComponent {
|
||||
this.state.pc.setRemoteDescription(desc).catch(this.reportError);
|
||||
}
|
||||
|
||||
reportError(errMessage) {
|
||||
console.log(`Error ${errMessage.name}: ${errMessage.message}`);
|
||||
reportError(err) {
|
||||
this.props.onError(err.message, 'err');
|
||||
}
|
||||
|
||||
handleNegotiationNeededEvent() {
|
||||
this.state.pc.createOffer().then(offer => {
|
||||
return this.state.pc.setLocalDescription(offer);
|
||||
})
|
||||
.then(() => {
|
||||
.then(_ => {
|
||||
this.props.onSendOffer(this.props.topic.name, this.props.seq, this.state.pc.localDescription.toJSON());
|
||||
})
|
||||
.catch(this.reportError);
|
||||
@@ -196,16 +196,17 @@ export default class CallPanel extends React.PureComponent {
|
||||
}
|
||||
|
||||
handleTrackEvent(event) {
|
||||
// Remote video becomes available.
|
||||
this.remoteRef.current.srcObject = event.streams[0];
|
||||
// Make sure we redraw the UI properly.
|
||||
// Make sure we display the title (peer's name) over the remote video.
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
||||
handleGetUserMediaError(e) {
|
||||
switch(e.name) {
|
||||
case 'NotFoundError':
|
||||
console.log("Unable to open your call because no camera and/or microphone" +
|
||||
"were found.");
|
||||
// Cannot start the call b/c no camera and/or microphone found.
|
||||
this.reportError(e);
|
||||
break;
|
||||
case 'SecurityError':
|
||||
case 'PermissionDeniedError':
|
||||
@@ -304,7 +305,7 @@ export default class CallPanel extends React.PureComponent {
|
||||
}
|
||||
track.enabled = !track.enabled;
|
||||
});
|
||||
// Make sure we redraw the UI properly.
|
||||
// Make sure we redraw the mute/unmute icons (e.g. mic -> mic_off).
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
||||
@@ -373,7 +374,6 @@ export default class CallPanel extends React.PureComponent {
|
||||
<button className="video-call-toggle-media" onClick={this.handleToggleCameraClick}><i className="material-icons">{videoIcon}</i></button>
|
||||
<button className="video-call-toggle-media" onClick={this.handleToggleMicClick}><i className="material-icons">{audioIcon}</i></button>
|
||||
</div>
|
||||
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -155,8 +155,8 @@ class BaseChatMessage extends React.PureComponent {
|
||||
defaultMessage="Incoming Call" description="Incoming call label" /> :
|
||||
<FormattedMessage id="calls_outgoing"
|
||||
defaultMessage="Outgoing Call" description="Outgoing call label" />;
|
||||
const isCallDropped = this.props.content == "disconnected";
|
||||
content = <><i className="material-icons" style={{color: isCallDropped ? "red" : "green"}}>{direction}</i>{text}
|
||||
const isCallDropped = this.props.content == 'disconnected';
|
||||
content = <><i className="material-icons" style={{color: isCallDropped ? 'red' : 'green'}}>{direction}</i>{text}
|
||||
{ !isCallDropped && this.props.duration ?
|
||||
[' (', <FormattedDuration seconds={this.props.duration / 1000} format="{hours} {minutes} {seconds}" />, ')'] :
|
||||
null}
|
||||
|
||||
@@ -71,8 +71,8 @@ class Contact extends React.Component {
|
||||
// The this.props.preview contains alreay shortened Drafty or string.
|
||||
let preview;
|
||||
if (this.props.previewIsVideoCall) {
|
||||
preview = <><i className='material-icons'>{this.props.previewIsResponse ? 'call_received' : 'call_made'}</i>
|
||||
<i className='material-icons'>video_call</i></>;
|
||||
preview = <><i className="material-icons">{this.props.previewIsResponse ? 'call_received' : 'call_made'}</i>
|
||||
<i className="material-icons">video_call</i></>;
|
||||
} else if (typeof this.props.preview == 'string') {
|
||||
preview = this.props.preview;
|
||||
} else if (Drafty.isValid(this.props.preview)) {
|
||||
|
||||
Reference in New Issue
Block a user