Commit c56e7df9 authored by Maxime FRERE's avatar Maxime FRERE

Use webRTCService instead of easyrtc or easyrtcConnector

parent 0ce98228
Pipeline #12153 failed with stage
......@@ -32,18 +32,18 @@ robotController = {
chatService: angular.element(document.body).injector().get('chat'),
getWebRTCAdapter: () => robotController.$injector.get('easyRTCAdapter'),
getWebRTCAdapter: () => robotController.$injector.get('webRTCService'),
getMyId: () => {
return easyrtc.myEasyrtcid;
return getWebRTCAdapter().myRtcid();
},
getRemoteStream: participant => {
return easyrtc.getRemoteStream(participant);
return getWebRTCAdapter().getRemoteStream(participant);
},
getRemoteParticipants: () => {
const participants = easyrtc.getRoomOccupantsAsArray(room); // Note that room is exposed globally
const participants = getWebRTCAdapter().getRemoteRtcIds(); // Note that room is exposed globally
const res = [];
if (participants) {
for (let i = 0; i < participants.length; i++) {
......
......@@ -160,9 +160,11 @@ robot = {
robotLib.archive = robotLib.archive(robot.clientConfig);
robotController.onAttendeePush = (e, data) => {
if (data.easyrtcid !== robotController.getMyId()) {
robot.recordParticipant(data.easyrtcid);
}
robotController.getMyId().then(rtcid => {
if (data.rtcid !== rtcid) {
robot.recordParticipant(data.rtcid);
}
});
};
robotController.onAttendeeRemove = (e, data) => {
......@@ -191,9 +193,11 @@ robot = {
// Record current participants already present in the room
// (except the robot itself)
for (const participantId of robotController.getRemoteParticipants()) {
if (participantId !== robotController.getMyId()) {
robot.recordParticipant(participantId);
}
robotController.getMyId().then(rtcid => {
if (participantId !== rtcid) {
robot.recordParticipant(participantId);
}
});
}
// Wait 5 minute before leaving a room if alone
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment