This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 829
Push-to-Talk Support for Jitsi #2280
Closed
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
8481a7b
Jitsi Push-to-Talk
anoadragon453 1a2923b
lint
anoadragon453 f5fbf97
Fix settings look
anoadragon453 4a0a26a
Add support for custom keybinding names
anoadragon453 aaa8aaa
Update rimraf
anoadragon453 dc0a6af
Remove UserSettings.js
anoadragon453 177d73c
Remove small fixes, electron addage
anoadragon453 964e850
hey it all works
anoadragon453 67a0cd5
Getting there
anoadragon453 22663c1
Fix issues
anoadragon453 2a41ebc
Add PTT toggle mode
anoadragon453 75b7fd0
UI Fixes
anoadragon453 6050c95
Cleanup, and ability to change shortcut during call
anoadragon453 d346c13
Update comments
anoadragon453 2e739cf
lint
anoadragon453 52348f7
lint
anoadragon453 6ac47fb
Fix UI and being unable to talk to widget
anoadragon453 fc7b1b3
Merge branch 'develop' into anoa/jitsi_ptt
anoadragon453 7e8411d
Fix build issues, move PushToTalk to class
anoadragon453 5cca1b4
Prevent erroneously setting state outside of settings window
anoadragon453 891554c
Change copyright and comment
anoadragon453 af78fa1
Fix custom key translations
anoadragon453 355d490
Remove dead code and fix translation
anoadragon453 ecf6596
Add translation to 'Not set'
anoadragon453 7d0fbc8
Merge branch 'develop' into anoa/jitsi_ptt
anoadragon453 1d10373
Change to yarn
anoadragon453 9dabafd
Merge branch 'develop' into anoa/jitsi_ptt
anoadragon453 3d11535
Merge branch 'develop' into anoa/jitsi_ptt
anoadragon453 ea20e60
Bump widget post message api version
anoadragon453 71fb229
Merge branch 'develop' into anoa/jitsi_ptt
anoadragon453 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
Copyright 2019 New Vector Ltd | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import PlatformPeg from './PlatformPeg'; | ||
import ActiveWidgetStore from './stores/ActiveWidgetStore'; | ||
import SettingsStore, { SettingLevel } from './settings/SettingsStore'; | ||
|
||
export default class PushToTalk { | ||
static id = "pushToTalk"; | ||
|
||
static start(keybinding) { | ||
// Call starting, start listening for keys | ||
const currentPTTState = SettingsStore.getValue(this.id); | ||
currentPTTState.isInCall = true; | ||
SettingsStore.setValue(this.id, null, SettingLevel.DEVICE, currentPTTState); | ||
this.setKeybinding(keybinding); | ||
} | ||
|
||
static stop() { | ||
// Call finished, stop listening for keys | ||
const currentPTTState = SettingsStore.getValue(this.id); | ||
currentPTTState.isInCall = false; | ||
SettingsStore.setValue(this.id, null, SettingLevel.DEVICE, currentPTTState); | ||
this.removeKeybinding(); | ||
} | ||
|
||
static setKeybinding(keybinding) { | ||
// Add keybinding listener | ||
PlatformPeg.get().addGlobalKeybinding(this.id, keybinding, () => { | ||
const widgetId = ActiveWidgetStore.getPersistentWidgetId(); | ||
|
||
// Only try to un/mute if jitsi is onscreen | ||
if (widgetId === null || widgetId === undefined) { | ||
return; | ||
} | ||
|
||
const widgetMessaging = ActiveWidgetStore.getWidgetMessaging(widgetId); | ||
|
||
// Toggle mic if in toggle mode, else just activate mic | ||
if (SettingsStore.getValue(this.id).toggle) { | ||
widgetMessaging.toggleJitsiAudio(); | ||
} else { | ||
widgetMessaging.unmuteJitsiAudio(); | ||
} | ||
}, () => { | ||
// No release functionality if toggle mode is enabled | ||
if (SettingsStore.getValue(this.id).toggle === true) { | ||
return; | ||
} | ||
|
||
const widgetId = ActiveWidgetStore.getPersistentWidgetId(); | ||
|
||
// Only try to un/mute if jitsi is onscreen | ||
if (widgetId === null || widgetId === undefined) { | ||
return; | ||
} | ||
|
||
const widgetMessaging = ActiveWidgetStore.getWidgetMessaging(widgetId); | ||
widgetMessaging.muteJitsiAudio(); | ||
}); | ||
PlatformPeg.get().startListeningKeys(); | ||
} | ||
|
||
static removeKeybinding() { | ||
// Remove keybinding listener | ||
const keybinding = SettingsStore.getValue(this.id).keybinding; | ||
PlatformPeg.get().removeGlobalKeybinding(this.id, keybinding); | ||
PlatformPeg.get().stopListeningKeys(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 3 actions should require a bump in API version, as shown here: https://github.com/matrix-org/matrix-react-sdk/pull/2781/files#diff-48acd843c021678a317564b0cf6d8648R24
Also, if you need to figure out if the widget will even support it, a toWidget API request for
supported_api_versions
should reveal that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So doing this instead of checking for"jitsi"
may be better?We don't check this way anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending to an older version is alright though, as it will just ignore the command?