Use MediaHandler
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
							parent
							
								
									1a4859ede8
								
							
						
					
					
						commit
						4c8c64a1cb
					
				| 
						 | 
				
			
			@ -17,8 +17,8 @@ limitations under the License.
 | 
			
		|||
 | 
			
		||||
import SettingsStore from "./settings/SettingsStore";
 | 
			
		||||
import { SettingLevel } from "./settings/SettingLevel";
 | 
			
		||||
import { setMatrixCallAudioInput, setMatrixCallVideoInput } from "matrix-js-sdk/src/matrix";
 | 
			
		||||
import EventEmitter from 'events';
 | 
			
		||||
import { MatrixClientPeg } from "./MatrixClientPeg";
 | 
			
		||||
 | 
			
		||||
// XXX: MediaDeviceKind is a union type, so we make our own enum
 | 
			
		||||
export enum MediaDeviceKindEnum {
 | 
			
		||||
| 
						 | 
				
			
			@ -74,8 +74,8 @@ export default class MediaDeviceHandler extends EventEmitter {
 | 
			
		|||
        const audioDeviceId = SettingsStore.getValue("webrtc_audioinput");
 | 
			
		||||
        const videoDeviceId = SettingsStore.getValue("webrtc_videoinput");
 | 
			
		||||
 | 
			
		||||
        setMatrixCallAudioInput(audioDeviceId);
 | 
			
		||||
        setMatrixCallVideoInput(videoDeviceId);
 | 
			
		||||
        MatrixClientPeg.get().getMediaHandler().setAudioInput(audioDeviceId);
 | 
			
		||||
        MatrixClientPeg.get().getMediaHandler().setVideoInput(videoDeviceId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public setAudioOutput(deviceId: string): void {
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +90,7 @@ export default class MediaDeviceHandler extends EventEmitter {
 | 
			
		|||
     */
 | 
			
		||||
    public setAudioInput(deviceId: string): void {
 | 
			
		||||
        SettingsStore.setValue("webrtc_audioinput", null, SettingLevel.DEVICE, deviceId);
 | 
			
		||||
        setMatrixCallAudioInput(deviceId);
 | 
			
		||||
        MatrixClientPeg.get().getMediaHandler().setAudioInput(deviceId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ export default class MediaDeviceHandler extends EventEmitter {
 | 
			
		|||
     */
 | 
			
		||||
    public setVideoInput(deviceId: string): void {
 | 
			
		||||
        SettingsStore.setValue("webrtc_videoinput", null, SettingLevel.DEVICE, deviceId);
 | 
			
		||||
        setMatrixCallVideoInput(deviceId);
 | 
			
		||||
        MatrixClientPeg.get().getMediaHandler().setVideoInput(deviceId);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public setDevice(deviceId: string, kind: MediaDeviceKindEnum): void {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue