From bad845e1959a9ed1461da7dd8c7934890ddceb56 Mon Sep 17 00:00:00 2001 From: Astagor Date: Mon, 4 May 2020 18:27:50 +0200 Subject: [PATCH 1/2] Browse passive participants --- app/src/RoomClient.js | 10 +++++++ app/src/Spotlights.js | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/app/src/RoomClient.js b/app/src/RoomClient.js index 8dbc9d1..656f443 100644 --- a/app/src/RoomClient.js +++ b/app/src/RoomClient.js @@ -298,6 +298,16 @@ export default class RoomClient switch (key) { + case String.fromCharCode(37): + { + this._spotlights.setPrevAsSelected(); + break; + } + case String.fromCharCode(39): + { + this._spotlights.setNextAsSelected(); + break; + } case 'A': // Activate advanced mode { store.dispatch(settingsActions.toggleAdvancedMode()); diff --git a/app/src/Spotlights.js b/app/src/Spotlights.js index 30dc48a..dd119df 100644 --- a/app/src/Spotlights.js +++ b/app/src/Spotlights.js @@ -12,6 +12,7 @@ export default class Spotlights extends EventEmitter this._signalingSocket = signalingSocket; this._maxSpotlights = maxSpotlights; this._peerList = []; + this._unmutablePeerList = []; this._selectedSpotlights = []; this._currentSpotlights = []; this._started = false; @@ -45,6 +46,66 @@ export default class Spotlights extends EventEmitter } } + setNextAsSelected() + { + let peerId = null; + if (this._selectedSpotlights.length > 0) { + peerId = this._selectedSpotlights[0]; + } else if (this._unmutablePeerList.length > 0) { + peerId = this._unmutablePeerList[0]; + } + + if (peerId != null && this._currentSpotlights.length < this._unmutablePeerList.length) { + let oldIndex = this._unmutablePeerList.indexOf(peerId); + let index = oldIndex; + index++; + do { + if (index >= this._unmutablePeerList.length) { + index = 0; + } + let newSelectedPeer = this._unmutablePeerList[index]; + if (!this._currentSpotlights.includes(newSelectedPeer)) { + this.setPeerSpotlight(newSelectedPeer); + break; + } + index++; + if (index === oldIndex) { + break; + } + } while (true); + } + } + + setPrevAsSelected() + { + let peerId = null; + if (this._selectedSpotlights.length > 0) { + peerId = this._selectedSpotlights[0]; + } else if (this._unmutablePeerList.length > 0) { + peerId = this._unmutablePeerList[0]; + } + + if (peerId != null && this._currentSpotlights.length < this._unmutablePeerList.length) { + let oldIndex = this._unmutablePeerList.indexOf(peerId); + let index = oldIndex; + index--; + do { + if (index < 0) { + index = this._unmutablePeerList.length - 1; + } + let newSelectedPeer = this._unmutablePeerList[index]; + if (!this._currentSpotlights.includes(newSelectedPeer)) { + this.setPeerSpotlight(newSelectedPeer); + break; + } + index--; + if (index === oldIndex) { + break; + } + } while (true); + } + } + setPeerSpotlight(peerId) { logger.debug('setPeerSpotlight() [peerId:"%s"]', peerId); @@ -105,6 +166,7 @@ export default class Spotlights extends EventEmitter logger.debug('_handlePeer() | adding peer [peerId: "%s"]', id); this._peerList.push(id); + this._unmutablePeerList.push(id); if (this._started) this._spotlightsUpdated(); @@ -117,6 +179,7 @@ export default class Spotlights extends EventEmitter 'room "peerClosed" event [peerId:%o]', id); this._peerList = this._peerList.filter((peer) => peer !== id); + this._unmutablePeerList = this._unmutablePeerList.filter((peer) => peer !== id); this._selectedSpotlights = this._selectedSpotlights.filter((peer) => peer !== id); From e4f6bde1647d9e9d6b8fd48e38d6c367e8aee455 Mon Sep 17 00:00:00 2001 From: Astagor Date: Wed, 13 May 2020 08:27:21 +0200 Subject: [PATCH 2/2] Added description of arrow keys for browsing passive peers into spotlight --- app/src/components/Controls/Help.js | 3 ++- app/src/translations/cn.json | 1 + app/src/translations/cs.json | 1 + app/src/translations/de.json | 1 + app/src/translations/dk.json | 1 + app/src/translations/el.json | 1 + app/src/translations/en.json | 1 + app/src/translations/es.json | 1 + app/src/translations/fr.json | 1 + app/src/translations/hr.json | 1 + app/src/translations/hu.json | 1 + app/src/translations/it.json | 1 + app/src/translations/lv.json | 1 + app/src/translations/nb.json | 1 + app/src/translations/pl.json | 1 + app/src/translations/pt.json | 1 + app/src/translations/ro.json | 1 + app/src/translations/tr.json | 1 + app/src/translations/uk.json | 1 + 19 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/components/Controls/Help.js b/app/src/components/Controls/Help.js index 98415b5..534f3e2 100644 --- a/app/src/components/Controls/Help.js +++ b/app/src/components/Controls/Help.js @@ -23,7 +23,8 @@ const shortcuts=[ { key: '1', label: 'label.democratic', defaultMessage: 'Democratic View' }, { key: '2', label: 'label.filmstrip', defaultMessage: 'Filmstrip View' }, { key: 'space', label: 'me.mutedPTT', defaultMessage: 'Push SPACE to talk' }, - { key: 'a', label: 'label.advanced', defaultMessage: 'Show advanced information' } + { key: 'a', label: 'label.advanced', defaultMessage: 'Show advanced information' }, + { key: String.fromCharCode(8592)+' '+String.fromCharCode(8594), label: 'room.browsePeersSpotlight', defaultMessage: 'Browse participants into Spotlight' } ]; const styles = (theme) => ({ diff --git a/app/src/translations/cn.json b/app/src/translations/cn.json index 0ae3fe0..2e4338c 100644 --- a/app/src/translations/cn.json +++ b/app/src/translations/cn.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/cs.json b/app/src/translations/cs.json index 8edfc1c..b76dc3b 100644 --- a/app/src/translations/cs.json +++ b/app/src/translations/cs.json @@ -62,6 +62,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/de.json b/app/src/translations/de.json index 0a2368a..e0cf1da 100644 --- a/app/src/translations/de.json +++ b/app/src/translations/de.json @@ -63,6 +63,7 @@ "room.help": "Hilfe", "room.about": "Über", "room.shortcutKeys": "Tastaturkürzel", + "room.browsePeersSpotlight": null, "me.mutedPTT": "Du bist stummgeschaltet. Halte die SPACE-Taste um zu sprechen", diff --git a/app/src/translations/dk.json b/app/src/translations/dk.json index fb9e6fc..0236280 100644 --- a/app/src/translations/dk.json +++ b/app/src/translations/dk.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/el.json b/app/src/translations/el.json index 2d9cb94..25df1a7 100644 --- a/app/src/translations/el.json +++ b/app/src/translations/el.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/en.json b/app/src/translations/en.json index 5014089..6237516 100644 --- a/app/src/translations/en.json +++ b/app/src/translations/en.json @@ -63,6 +63,7 @@ "room.help": "Help", "room.about": "About", "room.shortcutKeys": "Shortcut Keys", + "room.browsePeersSpotlight": null, "me.mutedPTT": "You are muted, hold down SPACE-BAR to talk", diff --git a/app/src/translations/es.json b/app/src/translations/es.json index 629bb2a..8075ff5 100644 --- a/app/src/translations/es.json +++ b/app/src/translations/es.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/fr.json b/app/src/translations/fr.json index 9776ac0..ea87e99 100644 --- a/app/src/translations/fr.json +++ b/app/src/translations/fr.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/hr.json b/app/src/translations/hr.json index 4788483..ef72efa 100644 --- a/app/src/translations/hr.json +++ b/app/src/translations/hr.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": "Utišani ste, pritisnite i držite SPACE tipku za razgovor", diff --git a/app/src/translations/hu.json b/app/src/translations/hu.json index dee4034..58d485a 100644 --- a/app/src/translations/hu.json +++ b/app/src/translations/hu.json @@ -63,6 +63,7 @@ "room.help": "Segítség", "room.about": "Névjegy", "room.shortcutKeys": "Billentyűparancsok", + "room.browsePeersSpotlight": null, "me.mutedPTT": "Némítva vagy, ha beszélnél nyomd le a szóköz billentyűt", diff --git a/app/src/translations/it.json b/app/src/translations/it.json index 7a8bf62..243eaca 100644 --- a/app/src/translations/it.json +++ b/app/src/translations/it.json @@ -63,6 +63,7 @@ "room.help": "Aiuto", "room.about": "Informazioni su", "room.shortcutKeys": "Scorciatoie da tastiera", + "room.browsePeersSpotlight": null, "me.mutedPTT": "Sei mutato, tieni premuto SPAZIO per parlare", diff --git a/app/src/translations/lv.json b/app/src/translations/lv.json index 27adce1..824e26b 100644 --- a/app/src/translations/lv.json +++ b/app/src/translations/lv.json @@ -62,6 +62,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": "Jūs esat noklusināts. Turiet taustiņu SPACE-BAR, lai runātu", diff --git a/app/src/translations/nb.json b/app/src/translations/nb.json index 172fcf9..10f387a 100644 --- a/app/src/translations/nb.json +++ b/app/src/translations/nb.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": "Du er dempet, hold nede SPACE for å snakke", diff --git a/app/src/translations/pl.json b/app/src/translations/pl.json index dd12971..948a62d 100644 --- a/app/src/translations/pl.json +++ b/app/src/translations/pl.json @@ -63,6 +63,7 @@ "room.help": "Pomoc", "room.about": "O pogramie", "room.shortcutKeys": "Skróty klawiaturowe", + "room.browsePeersSpotlight": null, "me.mutedPTT": "Masz wyciszony mikrofon, przytrzymaj spację aby mówić", diff --git a/app/src/translations/pt.json b/app/src/translations/pt.json index 13fd0f6..b354e65 100644 --- a/app/src/translations/pt.json +++ b/app/src/translations/pt.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/ro.json b/app/src/translations/ro.json index 8e05b0b..d718998 100644 --- a/app/src/translations/ro.json +++ b/app/src/translations/ro.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/tr.json b/app/src/translations/tr.json index dc05c2f..8647707 100644 --- a/app/src/translations/tr.json +++ b/app/src/translations/tr.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null, diff --git a/app/src/translations/uk.json b/app/src/translations/uk.json index b06aef4..dce9425 100644 --- a/app/src/translations/uk.json +++ b/app/src/translations/uk.json @@ -63,6 +63,7 @@ "room.help": null, "room.about": null, "room.shortcutKeys": null, + "room.browsePeersSpotlight": null, "me.mutedPTT": null,