Skip to content

Commit bee98b0

Browse files
committed
Updating Orion versions
1 parent 2e0ea74 commit bee98b0

1 file changed

Lines changed: 48 additions & 33 deletions

File tree

README.md

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -330,32 +330,32 @@ var wss = new ws.Server({
330330
path: "/helloworld"
331331
});
332332
333-
wss.on("connection", function (ws) {
333+
wss.on("connection", function(ws) {
334334
var sessionId = null;
335335
var request = ws.upgradeReq;
336336
var response = {
337337
writeHead: {}
338338
};
339339
340-
sessionHandler(request, response, function (err) {
340+
sessionHandler(request, response, function(err) {
341341
sessionId = request.session.id;
342342
});
343343
344-
ws.on("error", (error) => {
344+
ws.on("error", error => {
345345
stop(sessionId);
346346
});
347347
348348
ws.on("close", () => {
349349
stop(sessionId);
350350
});
351351
352-
ws.on("message", (_message) => {
352+
ws.on("message", _message => {
353353
var message = JSON.parse(_message);
354354
355355
switch (message.id) {
356356
case "start":
357357
sessionId = request.session.id;
358-
start(sessionId, ws, message.sdpOffer, function (error, sdpAnswer) {
358+
start(sessionId, ws, message.sdpOffer, function(error, sdpAnswer) {
359359
ws.send(
360360
JSON.stringify({
361361
id: "startResponse",
@@ -434,8 +434,8 @@ function start(sessionId, ws, sdpOffer, callback) {
434434
}
435435
}
436436
// Connect it back on itself (i.e. in loopback)
437-
connectMediaElements(webRtcEndpoint, (error) => {
438-
webRtcEndpoint.on("OnIceCandidate", function (event) {
437+
connectMediaElements(webRtcEndpoint, error => {
438+
webRtcEndpoint.on("OnIceCandidate", function(event) {
439439
const candidate = kurento.getComplexType("IceCandidate")(event.candidate);
440440
ws.send(
441441
JSON.stringify({
@@ -453,7 +453,7 @@ function start(sessionId, ws, sdpOffer, callback) {
453453
return callback(null, sdpAnswer);
454454
});
455455
456-
webRtcEndpoint.gatherCandidates((error) => {
456+
webRtcEndpoint.gatherCandidates(error => {
457457
if (error) {
458458
return callback(error);
459459
}
@@ -480,12 +480,15 @@ function createMediaElements(pipeline, ws, callback) {
480480

481481
```javascript
482482
function connectMediaElements(webRtcEndpoint, callback) {
483-
webRtcEndpoint.connect(webRtcEndpoint, (error) => {
484-
if (error) {
485-
return callback(error);
483+
webRtcEndpoint.connect(
484+
webRtcEndpoint,
485+
error => {
486+
if (error) {
487+
return callback(error);
488+
}
489+
return callback(null);
486490
}
487-
return callback(null);
488-
});
491+
);
489492
}
490493
```
491494

@@ -535,7 +538,7 @@ function start() {
535538
onicecandidate: onIceCandidate
536539
};
537540
538-
webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function (error) {
541+
webRtcPeer = kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options, function(error) {
539542
if (error) return onError(error);
540543
this.generateOffer(onOffer);
541544
});
@@ -560,7 +563,7 @@ Whenever a WebSocket message is received, either starting communication, changin
560563
an appropriate action is taken.
561564

562565
```javascript
563-
ws.onmessage = function (message) {
566+
ws.onmessage = function(message) {
564567
var parsedMessage = JSON.parse(message.data);
565568
566569
switch (parsedMessage.id) {
@@ -651,7 +654,7 @@ function createMediaElements(pipeline, ws, callback) {
651654
-1.2,
652655
1.6,
653656
1.6,
654-
function (error) {
657+
function(error) {
655658
if (error) {
656659
return callback(error);
657660
}
@@ -665,18 +668,24 @@ function createMediaElements(pipeline, ws, callback) {
665668

666669
```javascript
667670
function connectMediaElements(webRtcEndpoint, faceOverlayFilter, callback) {
668-
webRtcEndpoint.connect(faceOverlayFilter, (error) => {
669-
if (error) {
670-
return callback(error);
671-
}
672-
faceOverlayFilter.connect(webRtcEndpoint, (error) => {
671+
webRtcEndpoint.connect(
672+
faceOverlayFilter,
673+
error => {
673674
if (error) {
674675
return callback(error);
675676
}
677+
faceOverlayFilter.connect(
678+
webRtcEndpoint,
679+
error => {
680+
if (error) {
681+
return callback(error);
682+
}
676683
677-
return callback(null);
678-
});
679-
});
684+
return callback(null);
685+
}
686+
);
687+
}
688+
);
680689
}
681690
```
682691

@@ -807,19 +816,25 @@ function createMediaElements(pipeline, ws, callback) {
807816

808817
```javascript
809818
function connectMediaElements(webRtcEndpoint, filter, callback) {
810-
webRtcEndpoint.connect(filter, (error) => {
811-
if (error) {
812-
return callback(error);
813-
}
814-
815-
filter.connect(webRtcEndpoint, (error) => {
819+
webRtcEndpoint.connect(
820+
filter,
821+
error => {
816822
if (error) {
817823
return callback(error);
818824
}
819825

820-
return callback(null);
821-
});
822-
});
826+
filter.connect(
827+
webRtcEndpoint,
828+
error => {
829+
if (error) {
830+
return callback(error);
831+
}
832+
833+
return callback(null);
834+
}
835+
);
836+
}
837+
);
823838
}
824839
```
825840

0 commit comments

Comments
 (0)