Skip to content

Commit 3cc0ccf

Browse files
committed
Format README
1 parent f73c547 commit 3cc0ccf

1 file changed

Lines changed: 41 additions & 41 deletions

File tree

README.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ kurento:
181181
hostname: kurento
182182
container_name: fiware-kurento
183183
expose:
184-
- "8888"
184+
- '8888'
185185
ports:
186186
- 8888:8888
187187
networks:
@@ -208,11 +208,11 @@ kurento-examples:
208208
networks:
209209
- default
210210
environment:
211-
- "MEDIA_SERVER_HOST=kurento"
212-
- "MEDIA_SERVER_PORT=8888"
213-
- "APP_SERVER_HOST=kurento-examples"
214-
- "APP_SERVER_PORT=8443"
215-
- "TUTORIAL_NAME=${TUTORIAL_NAME}"
211+
- 'MEDIA_SERVER_HOST=kurento'
212+
- 'MEDIA_SERVER_PORT=8888'
213+
- 'APP_SERVER_HOST=kurento-examples'
214+
- 'APP_SERVER_PORT=8443'
215+
- 'TUTORIAL_NAME=${TUTORIAL_NAME}'
216216
```
217217
218218
The `kurento-examples` container is a web app server listening on a single port:
@@ -294,7 +294,7 @@ page. The application consists of a single HTML web page containing two HTML5 `<
294294
stream (as captured by the local webcam) and the other showing the remote stream sent by the media server back to the
295295
client. Click on the start button and the same video will be displayed in both `<video>` elements.
296296

297-
[![](https://fiware.github.io/tutorials.Media-Streams/img/hello-world-screenshot.png)](https://www.youtube.com/watch?v=vGEnkSOp_xc "Hello World")
297+
[![](https://fiware.github.io/tutorials.Media-Streams/img/hello-world-screenshot.png)](https://www.youtube.com/watch?v=vGEnkSOp_xc 'Hello World')
298298

299299
Click on the image above to watch a demo of the hello world example.
300300

@@ -325,14 +325,14 @@ Dynamic communication between the frontend rendered web page and the backend app
325325
can be seen below:
326326

327327
```javascript
328-
var ws = require("ws");
328+
var ws = require('ws');
329329
330330
var wss = new ws.Server({
331331
server: server,
332-
path: "/helloworld"
332+
path: '/helloworld'
333333
});
334334
335-
wss.on("connection", function (ws) {
335+
wss.on('connection', function (ws) {
336336
var sessionId = null;
337337
var request = ws.upgradeReq;
338338
var response = {
@@ -343,35 +343,35 @@ wss.on("connection", function (ws) {
343343
sessionId = request.session.id;
344344
});
345345
346-
ws.on("error", (error) => {
346+
ws.on('error', (error) => {
347347
stop(sessionId);
348348
});
349349
350-
ws.on("close", () => {
350+
ws.on('close', () => {
351351
stop(sessionId);
352352
});
353353
354-
ws.on("message", (_message) => {
354+
ws.on('message', (_message) => {
355355
var message = JSON.parse(_message);
356356
357357
switch (message.id) {
358-
case "start":
358+
case 'start':
359359
sessionId = request.session.id;
360360
start(sessionId, ws, message.sdpOffer, function (error, sdpAnswer) {
361361
ws.send(
362362
JSON.stringify({
363-
id: "startResponse",
363+
id: 'startResponse',
364364
sdpAnswer: sdpAnswer
365365
})
366366
);
367367
});
368368
break;
369369
370-
case "stop":
370+
case 'stop':
371371
stop(sessionId);
372372
break;
373373
374-
case "onIceCandidate":
374+
case 'onIceCandidate':
375375
onIceCandidate(sessionId, message.candidate);
376376
break;
377377
}
@@ -395,14 +395,14 @@ Environment Variables values specified. For example, if the Kurento is hosted at
395395
`8888`.
396396

397397
```javascript
398-
const kurento = require("kurento-client");
398+
const kurento = require('kurento-client');
399399
400400
function getKurentoClient(callback) {
401401
if (kurentoClient !== null) {
402402
return callback(null, kurentoClient);
403403
}
404404
405-
kurento("ws://kurento-server:8888/kurento", (error, _kurentoClient) => {
405+
kurento('ws://kurento-server:8888/kurento', (error, _kurentoClient) => {
406406
kurentoClient = _kurentoClient;
407407
callback(null, kurentoClient);
408408
});
@@ -427,7 +427,7 @@ These functions are called in the `start()` function, which is fired when the `s
427427
function start(sessionId, ws, sdpOffer, callback) {
428428
getKurentoClient((error, kurentoClient) => {
429429
// Create a Media Pipeline
430-
kurentoClient.create("MediaPipeline", (error, pipeline) => {
430+
kurentoClient.create('MediaPipeline', (error, pipeline) => {
431431
createMediaElements(pipeline, ws, (error, webRtcEndpoint) => {
432432
if (candidatesQueue[sessionId]) {
433433
while (candidatesQueue[sessionId].length) {
@@ -437,11 +437,11 @@ function start(sessionId, ws, sdpOffer, callback) {
437437
}
438438
// Connect it back on itself (i.e. in loopback)
439439
connectMediaElements(webRtcEndpoint, (error) => {
440-
webRtcEndpoint.on("OnIceCandidate", function (event) {
441-
const candidate = kurento.getComplexType("IceCandidate")(event.candidate);
440+
webRtcEndpoint.on('OnIceCandidate', function (event) {
441+
const candidate = kurento.getComplexType('IceCandidate')(event.candidate);
442442
ws.send(
443443
JSON.stringify({
444-
id: "iceCandidate",
444+
id: 'iceCandidate',
445445
candidate: candidate
446446
})
447447
);
@@ -471,7 +471,7 @@ Where `createMediaElements()` and `connectMediaElements()` are the following cal
471471

472472
```javascript
473473
function createMediaElements(pipeline, ws, callback) {
474-
pipeline.create("WebRtcEndpoint", (error, webRtcEndpoint) => {
474+
pipeline.create('WebRtcEndpoint', (error, webRtcEndpoint) => {
475475
if (error) {
476476
return callback(error);
477477
}
@@ -523,9 +523,9 @@ JavaScript library - `kurento-utils.js` used to simplify the WebRTC interaction
523523
complete JavaScript can be found in `static/js/index.js`.
524524

525525
```javascript
526-
var ws = new WebSocket("wss://" + location.host + "/helloworld");
527-
var videoInput = document.getElementById("videoInput");
528-
var videoOutput = document.getElementById("videoOutput");
526+
var ws = new WebSocket('wss://' + location.host + '/helloworld');
527+
var videoInput = document.getElementById('videoInput');
528+
var videoOutput = document.getElementById('videoOutput');
529529
var webRtcPeer = null;
530530
```
531531

@@ -545,14 +545,14 @@ function start() {
545545
546546
function onIceCandidate(candidate) {
547547
sendMessage({
548-
id: "onIceCandidate",
548+
id: 'onIceCandidate',
549549
candidate: candidate
550550
});
551551
}
552552
553553
function onOffer(error, offerSdp) {
554554
sendMessage({
555-
id: "start",
555+
id: 'start',
556556
sdpOffer: offerSdp
557557
});
558558
}
@@ -566,13 +566,13 @@ ws.onmessage = function (message) {
566566
var parsedMessage = JSON.parse(message.data);
567567
568568
switch (parsedMessage.id) {
569-
case "startResponse":
569+
case 'startResponse':
570570
webRtcPeer.processAnswer(message.sdpAnswer);
571571
break;
572-
case "iceCandidate":
572+
case 'iceCandidate':
573573
webRtcPeer.addIceCandidate(parsedMessage.candidate);
574574
break;
575-
case "error":
575+
case 'error':
576576
// Error Handling
577577
break;
578578
}
@@ -606,7 +606,7 @@ client. Click on the start button and the modified video will be displayed in on
606606

607607
[![](https://fiware.github.io/tutorials.Media-Streams/img/magic-mirror-screenshot.png)
608608

609-
Click on the link to watch a [demo of the magic mirror](https://www.youtube.com/watch?v=h84HFkvWGgw "Magic Mirror")
609+
Click on the link to watch a [demo of the magic mirror](https://www.youtube.com/watch?v=h84HFkvWGgw 'Magic Mirror')
610610

611611
## Magic Mirror - Analyzing the Code
612612

@@ -637,18 +637,18 @@ need to extend the `createMediaElements()` and `connectMediaElements()` function
637637

638638
```javascript
639639
function createMediaElements(pipeline, ws, callback) {
640-
pipeline.create("WebRtcEndpoint", (error, webRtcEndpoint) => {
640+
pipeline.create('WebRtcEndpoint', (error, webRtcEndpoint) => {
641641
if (error) {
642642
return callback(error);
643643
}
644644
// Once the WebRtcEndpoint is created create a FaceOverlayFilter
645-
pipeline.create("FaceOverlayFilter", (error, faceOverlayFilter) => {
645+
pipeline.create('FaceOverlayFilter', (error, faceOverlayFilter) => {
646646
if (error) {
647647
return callback(error);
648648
}
649649
// This adds the Mario hat
650650
faceOverlayFilter.setOverlayedImage(
651-
url.format(asUrl) + "img/mario-wings.png",
651+
url.format(asUrl) + 'img/mario-wings.png',
652652
-0.35,
653653
-1.2,
654654
1.6,
@@ -782,21 +782,21 @@ apt-get -y install kms-pointerdetector-6.0 \
782782
For the example, we only need to register the `kurento-module-platedetector` module to make the filter available:
783783

784784
```javascript
785-
const kurento = require("kurento-client");
786-
kurento.register("kurento-module-platedetector");
785+
const kurento = require('kurento-client');
786+
kurento.register('kurento-module-platedetector');
787787
```
788788

789789
The `platedetector.PlateDetectorFilter` can be then be created using the `pipeline.create()` function. Extending the
790790
`createMediaElements()` and `connectMediaElements()` functions as shown below to add the filter to the Media pipeline:
791791

792792
```javascript
793793
function createMediaElements(pipeline, ws, callback) {
794-
pipeline.create("WebRtcEndpoint", (error, webRtcEndpoint) => {
794+
pipeline.create('WebRtcEndpoint', (error, webRtcEndpoint) => {
795795
if (error) {
796796
return callback(error);
797797
}
798798

799-
pipeline.create("platedetector.PlateDetectorFilter", (error, filter) => {
799+
pipeline.create('platedetector.PlateDetectorFilter', (error, filter) => {
800800
if (error) {
801801
return callback(error);
802802
}
@@ -845,7 +845,7 @@ ws.onmessage = function(message) {
845845
846846
```javascript
847847
function plateDetected(message) {
848-
console.log("License plate detected " + message.data.plate);
848+
console.log('License plate detected ' + message.data.plate);
849849
}
850850
```
851851

0 commit comments

Comments
 (0)