Sfoglia il codice sorgente

Exposes a Command(s) API from conference.js.

j8
Lyubomir Marinov 9 anni fa
parent
commit
972fc402e4
1 ha cambiato i file con 45 aggiunte e 0 eliminazioni
  1. 45
    0
      conference.js

+ 45
- 0
conference.js Vedi File

506
 
506
 
507
         this._setupListeners();
507
         this._setupListeners();
508
     },
508
     },
509
+
510
+    /**
511
+     * Exposes a Command(s) API on this instance. It is necessitated by (1) the
512
+     * desire to keep room private to this instance and (2) the need of other
513
+     * modules to send and receive commands to and from participants.
514
+     * Eventually, this instance remains in control with respect to the
515
+     * decision whether the Command(s) API of room (i.e. lib-jitsi-meet's
516
+     * JitsiConference) is to be used in the implementation of the Command(s)
517
+     * API of this instance.
518
+     */
519
+    commands: {
520
+        /**
521
+         * Receives notifications from other participants about commands aka
522
+         * custom events (sent by sendCommand or sendCommandOnce methods).
523
+         * @param command {String} the name of the command
524
+         * @param handler {Function} handler for the command
525
+         */
526
+        addCommandListener () {
527
+            room.addCommandListener.apply(room, arguments);
528
+        },
529
+        /**
530
+         * Removes command.
531
+         * @param name {String} the name of the command.
532
+         */
533
+        removeCommand () {
534
+            room.removeCommand.apply(room, arguments);
535
+        },
536
+        /**
537
+         * Sends command.
538
+         * @param name {String} the name of the command.
539
+         * @param values {Object} with keys and values that will be sent.
540
+         */
541
+        sendCommand () {
542
+            room.sendCommand.apply(room, arguments);
543
+        },
544
+        /**
545
+         * Sends command one time.
546
+         * @param name {String} the name of the command.
547
+         * @param values {Object} with keys and values that will be sent.
548
+         */
549
+        sendCommandOnce () {
550
+            room.sendCommandOnce.apply(room, arguments);
551
+        },
552
+    },
553
+
509
     _getConferenceOptions() {
554
     _getConferenceOptions() {
510
         let options = config;
555
         let options = config;
511
         if(config.enableRecording) {
556
         if(config.enableRecording) {

Loading…
Annulla
Salva