-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
163 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
.chat_timespan { | ||
color: #848484; | ||
} | ||
|
||
#selfVideo { | ||
height:225px; | ||
width:300px; | ||
float:left; | ||
border:1px solid gray; | ||
margin-left:10px; | ||
} | ||
|
||
#callerVideo { | ||
height:225px; | ||
width:300px; | ||
border:1px solid gray; | ||
margin-left:10px; | ||
} | ||
|
||
.easyrtc_closeButton { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<h1>Audio video simple</h1> | ||
<h2>I am <small><span ng-bind="user.easyRtcId"></span></small></h2> | ||
<div class="well"> | ||
<div class="row"> | ||
<h4>List of users</h4> | ||
<div ng-repeat="user in users"> | ||
<span ng-bind="user.name"></span> | ||
<button class="btn btn-link" ng-show="user.isConnected!=true" ng-click="call(user.easyRtcId)">Connect</button> | ||
<button class="btn btn-link" ng-show="user.isConnected==true" ng-click="hangup(user.easyRtcId)">Disconnect</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="well"> | ||
<div class="row"> | ||
<div class="col-md-5"> | ||
<video autoplay="autoplay" class="easyrtcMirror" id="selfVideo" muted="muted" volume="0" ></video> | ||
</div> | ||
<div class="col-md-5 col-md-offset-2"> | ||
<video autoplay="autoplay" id="callerVideo" class="pull-right"></video> | ||
</div> | ||
</div> | ||
</div> |
103 changes: 103 additions & 0 deletions
103
client/js/pages/audiovideosimple/audiovideosimple_ctrl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
angular.module('cam').controller('audioVideoSimpleCtrl', ['$scope', function ($scope) { | ||
var _init = function () { | ||
$scope.user = {}; | ||
$scope.users = []; | ||
$scope.chat = {allMsgs: '', msg: ''}; | ||
|
||
easyrtc.setPeerListener(_peerListener); | ||
easyrtc.setRoomOccupantListener(_convertListToButtons); | ||
easyrtc.easyApp("easyrtc.audioVideo", "selfVideo", ["callerVideo"], _loginSuccess, _loginFailure); | ||
}; | ||
|
||
$scope.call = function (to) { | ||
_hangupAllClients(); | ||
easyrtc.call(to, _callSuccess, _callFailed, _callAccepted); | ||
easyrtc.sendDataWS(to, "chat:videoconnected", null); | ||
}; | ||
|
||
$scope.hangup = function (to) { | ||
_hangupAllClients(); | ||
easyrtc.sendDataWS(to, "chat:videodisconnected", null); | ||
}; | ||
|
||
var _peerListener = function (who, msgType, content) { | ||
if (msgType === 'chat:videoconnected') { | ||
_findUserByEasyRtcId(who).isConnected = true; | ||
} | ||
else if (msgType === 'chat:videodisconnected') { | ||
_findUserByEasyRtcId(who).isConnected = false; | ||
} | ||
|
||
$scope.$apply(); | ||
}; | ||
|
||
var _callSuccess = function (to) { | ||
_findUserByEasyRtcId(to).isConnected = true; | ||
$scope.$apply(); | ||
}; | ||
|
||
var _callFailed = function (errCode, errMsg) { }; | ||
|
||
var _callAccepted = function (accepted, from) { }; | ||
|
||
var _hangupAllClients = function () { | ||
easyrtc.hangupAll(); | ||
|
||
if ($scope.users) { | ||
for (var i = 0; i < $scope.users.length; i++) { | ||
$scope.users[i].isConnected = false; | ||
} | ||
} | ||
}; | ||
|
||
var _loginSuccess = function (easyrtcid) { | ||
$scope.user.easyRtcId = easyrtcid; | ||
$scope.$apply(); | ||
}; | ||
|
||
var _loginFailure = function (errorCode, message) { | ||
easyrtc.showError(errorCode, message); | ||
$scope.$apply(); | ||
}; | ||
|
||
var _convertListToButtons = function (roomName, occupants, isPrimary) { | ||
var oldUsers = angular.copy($scope.users); | ||
$scope.users = []; | ||
|
||
for (easyRtc in occupants) { | ||
$scope.users.push({ | ||
easyRtcId: easyRtc, | ||
name: easyRtc, | ||
isConnected: _findOldUser(oldUsers, easyRtc) | ||
}); | ||
} | ||
|
||
$scope.$apply(); | ||
}; | ||
|
||
var _findOldUser = function (oldUsers, easyRtc) { | ||
if (oldUsers) { | ||
for (var i = 0; i < oldUsers.length; i++) { | ||
if (oldUsers[i].easyRtcId === easyRtc) { | ||
return oldUsers.isConnected; | ||
} | ||
} | ||
} | ||
|
||
return false; | ||
}; | ||
|
||
var _findUserByEasyRtcId = function (id) { | ||
if (id) { | ||
for (var i = 0; i < $scope.users.length; i++) { | ||
if ($scope.users[i].easyRtcId === id) { | ||
return $scope.users[i]; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
_init(); | ||
}]); |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters