Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #685 from kisabaka/master
Browse files Browse the repository at this point in the history
Show a persistent warning about TURN through the call
  • Loading branch information
kisabaka authored Sep 14, 2020
2 parents e90fc35 + 06b18b5 commit 21b0f27
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/web_app/html/index_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ <h1>AppRTC</h1>
</div>
<div id="info-div">Code for AppRTC is available from <a href="http://github.com/webrtc/apprtc" title="GitHub repo for AppRTC">github.com/webrtc/apprtc</a></div>
<div id="status-div"></div>
<div id="turn-info-div"></div>
<div id="rejoin-div" class="hidden"><span>You have left the call.</span> <button id="rejoin-button">REJOIN</button><button id="new-room-button">NEW ROOM</button></div>
</footer>

Expand Down
15 changes: 14 additions & 1 deletion src/web_app/js/appcontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var UI_CONSTANTS = {
roomSelectionRecentList: '#recent-rooms-list',
sharingDiv: '#sharing-div',
statusDiv: '#status-div',
turnInfoDiv: '#turn-info-div',
videosDiv: '#videos',
};

Expand All @@ -60,6 +61,7 @@ var AppController = function(loadingParams) {
this.miniVideo_ = $(UI_CONSTANTS.miniVideo);
this.sharingDiv_ = $(UI_CONSTANTS.sharingDiv);
this.statusDiv_ = $(UI_CONSTANTS.statusDiv);
this.turnInfoDiv_ = $(UI_CONSTANTS.turnInfoDiv);
this.remoteVideo_ = $(UI_CONSTANTS.remoteVideo);
this.videosDiv_ = $(UI_CONSTANTS.videosDiv);
this.roomLinkHref_ = $(UI_CONSTANTS.roomLinkHref);
Expand Down Expand Up @@ -168,7 +170,7 @@ AppController.prototype.createCall_ = function() {
this.infoBox_.recordIceCandidateTypes.bind(this.infoBox_);

this.call_.onerror = this.displayError_.bind(this);
this.call_.onstatusmessage = this.displayStatus_.bind(this);
this.call_.onturnstatusmessage = this.displayTurnStatus_.bind(this);
this.call_.oncallerstarted = this.displaySharingInfo_.bind(this);
};

Expand Down Expand Up @@ -273,6 +275,7 @@ AppController.prototype.waitForRemoteVideo_ = function() {

AppController.prototype.onRemoteStreamAdded_ = function(stream) {
this.deactivate_(this.sharingDiv_);
this.displayTurnStatus_('');
trace('Remote stream added.');
this.remoteVideo_.srcObject = stream;
this.infoBox_.getRemoteTrackIds(stream);
Expand Down Expand Up @@ -371,6 +374,7 @@ AppController.prototype.transitionToDone_ = function() {
this.activate_(this.rejoinDiv_);
this.show_(this.rejoinDiv_);
this.displayStatus_('');
this.displayTurnStatus_('');
};

AppController.prototype.onRejoinClick_ = function() {
Expand Down Expand Up @@ -446,6 +450,15 @@ AppController.prototype.displayStatus_ = function(status) {
this.statusDiv_.innerHTML = status;
};

AppController.prototype.displayTurnStatus_ = function(status) {
if (status === '') {
this.deactivate_(this.turnInfoDiv_);
} else {
this.activate_(this.turnInfoDiv_);
}
this.turnInfoDiv_.innerHTML = status;
};

AppController.prototype.displayError_ = function(error) {
trace(error);
this.infoBox_.pushErrorMessage(error);
Expand Down
6 changes: 3 additions & 3 deletions src/web_app/js/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var Call = function(params) {
this.onremotesdpset = null;
this.onremotestreamadded = null;
this.onsignalingstatechange = null;
this.onstatusmessage = null;
this.onturnstatusmessage = null;

this.getMediaPromise_ = null;
this.getIceServersPromise_ = null;
Expand Down Expand Up @@ -344,11 +344,11 @@ Call.prototype.maybeGetIceServers_ = function() {
this.params_.peerConnectionConfig.iceServers =
servers.concat(iceServers);
}.bind(this)).catch(function(error) {
if (this.onstatusmessage) {
if (this.onturnstatusmessage) {
// Error retrieving ICE servers.
var subject =
encodeURIComponent('AppRTC demo ICE servers not working');
this.onstatusmessage(
this.onturnstatusmessage(
'No TURN server; unlikely that media will traverse networks. ' +
'If this persists please ' +
'<a href="mailto:[email protected]?' +
Expand Down

0 comments on commit 21b0f27

Please sign in to comment.