-
Notifications
You must be signed in to change notification settings - Fork 113
Audio device controls for mobile native audio device selection #3270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 42 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
5632810
Add custom audio renderer to only render joined participants & add io…
toger5 6b8c620
Add tests
toger5 18a59dd
use optional audio context and effect to initiate it + review
toger5 53adfa4
WIP
robintown f9b04ae
temp
toger5 f69c753
add earpice mode
toger5 6b39d0a
turn on url flag by default
toger5 86beaeb
apply mute from mobile controls
toger5 c8091ac
Quickfix for testing
toger5 7fa534d
refactor
toger5 610e792
rename setOutputDevices-> setAvailableOutputDevices
toger5 abd66f5
fix mute all audio via controls
toger5 2012b09
review cleanup
toger5 7227c7b
Merge branch 'livekit' into robin/audio-output-controls
toger5 7a4c189
test for mute all audio
toger5 acaf69c
add change audio button with callback on ios
toger5 abf683f
Hide the input list on both, android+ios.
toger5 35963bb
Add flags to optimize EC device handling
toger5 7f4b0a3
`isBluetooth` -> `isExternalHeadset`
toger5 01a2cd1
bump livekit client (the current version has an issue on safari)
toger5 c22e0cb
better logging
toger5 2946b30
fix no audio thinko.
toger5 956b7fc
actually test the impl
toger5 5d6ec19
Allow some controls to be set before the call view is loaded.
toger5 6d0697c
inform ios about earpice mode
toger5 d94feaa
smaller diff
toger5 e8c6d79
logger instead of native window picker
toger5 d7e0abc
remove the whole button on click logic
toger5 ed234a1
change label on button
toger5 7fd7dc3
use normal button
toger5 aa00a95
ITS A FORM NOOOOO
toger5 fb95ba2
make the button prettty again
toger5 c11a37c
back to non translated label
toger5 0412629
fix start with for output devices.
toger5 1cf11b9
Back to translated button
toger5 a1759a4
rename everything to `controlledMediaDevices` to make it consistent w…
toger5 435a7d0
earpice -> earpiece
toger5 a056a28
review
toger5 ab9dfc7
Comment to explain the usage/impact of: `controlledMediaDevices`
toger5 323e088
use js-sdk branch as in livekit branch
toger5 4eb8674
Merge branch 'livekit' into robin/audio-output-controls
toger5 9f84a5c
Deprecate old naming and introduce new words
toger5 fa0b521
Update docs/controls.md
toger5 f0403c8
also add non deprecated audio url parameter
toger5 269565d
Update docs/url-params.md
toger5 045d861
Merge branch 'livekit' into robin/audio-output-controls
robintown 78c59bb
Fix formatting
robintown 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 hidden or 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 |
---|---|---|
@@ -1,7 +1,21 @@ | ||
# Global JS controls | ||
|
||
A few aspects of Element Call's interface can be controlled through a global API on the `window`: | ||
A few aspects of Element Call's interface can be controlled through a global API on the `window`. | ||
|
||
## Picture-in-picture | ||
|
||
- `controls.canEnterPip(): boolean` Determines whether it's possible to enter picture-in-picture mode. | ||
- `controls.enablePip(): void` Puts the call interface into picture-in-picture mode. Throws if not in a call. | ||
- `controls.disablePip(): void` Takes the call interface out of picture-in-picture mode, restoring it to its natural display mode. Throws if not in a call. | ||
|
||
## Audio output devices | ||
|
||
On mobile platforms (iOS, Android), web views do not reliably support selecting audio output devices such as the main speaker, earpiece, or headset. To address this limitation, the following functions allow the hosting application (e.g., Element Web, Element X) to manage audio devices via exposed JavaScript interfaces. These functions must be enabled using the URL parameter `controlledAudioDevices` to take effect. | ||
|
||
- `controls.setAvailableAudioDevices(devices: { id: string, name: string, forEarpiece?: boolean, isEarpiece?: boolean isSpeaker?: boolean, isExternalHeadset?, boolean; }[]): void` Sets the list of available audio outputs. `forEarpiece` is used on iOS only. | ||
It flags the device that should be used if the user selects earpiece mode. This should be the main stereo loudspeaker of the device. | ||
- `controls.onAudioDeviceSelect: ((id: string) => void) | undefined` Callback called whenever the user or application selects a new audio output. | ||
- `controls.setAudioDevice(id: string): void` Sets the selected audio device in Element Call's menu. This should be used if the OS decides to automatically switch to Bluetooth, for example. | ||
- `controls.setAudioEnabled(enabled: boolean)` Enables/disables all audio output from the application. This can be useful for temporarily pausing audio while the controlling application is switching output devices. Output is enabled by default. | ||
toger5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- `showNativeAudioDevicePicker: (() => void) | undefined`. Callback called whenever the user presses the output button in the settings menu. | ||
This button is only shown on iOS. (`userAgent.includes("iPhone")`) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.