@@ -72,12 +72,12 @@ export default class MediaDeviceHandler extends EventEmitter {
72
72
/**
73
73
* Retrieves devices from the SettingsStore and tells the js-sdk to use them
74
74
*/
75
- public static loadDevices ( ) : void {
75
+ public static async loadDevices ( ) : Promise < void > {
76
76
const audioDeviceId = SettingsStore . getValue ( "webrtc_audioinput" ) ;
77
77
const videoDeviceId = SettingsStore . getValue ( "webrtc_videoinput" ) ;
78
78
79
- MatrixClientPeg . get ( ) . getMediaHandler ( ) . setAudioInput ( audioDeviceId ) ;
80
- MatrixClientPeg . get ( ) . getMediaHandler ( ) . setVideoInput ( videoDeviceId ) ;
79
+ await MatrixClientPeg . get ( ) . getMediaHandler ( ) . setAudioInput ( audioDeviceId ) ;
80
+ await MatrixClientPeg . get ( ) . getMediaHandler ( ) . setVideoInput ( videoDeviceId ) ;
81
81
}
82
82
83
83
public setAudioOutput ( deviceId : string ) : void {
@@ -90,26 +90,26 @@ export default class MediaDeviceHandler extends EventEmitter {
90
90
* need to be ended and started again for this change to take effect
91
91
* @param {string } deviceId
92
92
*/
93
- public setAudioInput ( deviceId : string ) : void {
93
+ public async setAudioInput ( deviceId : string ) : Promise < void > {
94
94
SettingsStore . setValue ( "webrtc_audioinput" , null , SettingLevel . DEVICE , deviceId ) ;
95
- MatrixClientPeg . get ( ) . getMediaHandler ( ) . setAudioInput ( deviceId ) ;
95
+ return MatrixClientPeg . get ( ) . getMediaHandler ( ) . setAudioInput ( deviceId ) ;
96
96
}
97
97
98
98
/**
99
99
* This will not change the device that a potential call uses. The call will
100
100
* need to be ended and started again for this change to take effect
101
101
* @param {string } deviceId
102
102
*/
103
- public setVideoInput ( deviceId : string ) : void {
103
+ public async setVideoInput ( deviceId : string ) : Promise < void > {
104
104
SettingsStore . setValue ( "webrtc_videoinput" , null , SettingLevel . DEVICE , deviceId ) ;
105
- MatrixClientPeg . get ( ) . getMediaHandler ( ) . setVideoInput ( deviceId ) ;
105
+ return MatrixClientPeg . get ( ) . getMediaHandler ( ) . setVideoInput ( deviceId ) ;
106
106
}
107
107
108
- public setDevice ( deviceId : string , kind : MediaDeviceKindEnum ) : void {
108
+ public async setDevice ( deviceId : string , kind : MediaDeviceKindEnum ) : Promise < void > {
109
109
switch ( kind ) {
110
110
case MediaDeviceKindEnum . AudioOutput : this . setAudioOutput ( deviceId ) ; break ;
111
- case MediaDeviceKindEnum . AudioInput : this . setAudioInput ( deviceId ) ; break ;
112
- case MediaDeviceKindEnum . VideoInput : this . setVideoInput ( deviceId ) ; break ;
111
+ case MediaDeviceKindEnum . AudioInput : await this . setAudioInput ( deviceId ) ; break ;
112
+ case MediaDeviceKindEnum . VideoInput : await this . setVideoInput ( deviceId ) ; break ;
113
113
}
114
114
}
115
115
0 commit comments