Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-05-25 01:25:17 +01:00
parent 09d0ab7df5
commit 8158ec6d54

View file

@ -820,8 +820,7 @@ module.exports = React.createClass({
CallMediaHandler.setVideoInput(deviceId); CallMediaHandler.setVideoInput(deviceId);
}, },
_requestMediaPermissions: function() { _requestMediaPermissions: function(event) {
console.log("Request media perms");
const getUserMedia = ( const getUserMedia = (
window.navigator.getUserMedia || window.navigator.webkitGetUserMedia || window.navigator.mozGetUserMedia window.navigator.getUserMedia || window.navigator.webkitGetUserMedia || window.navigator.mozGetUserMedia
); );
@ -829,7 +828,13 @@ module.exports = React.createClass({
return getUserMedia.apply(window.navigator, [ return getUserMedia.apply(window.navigator, [
{ video: true, audio: true }, { video: true, audio: true },
this._refreshMediaDevices, this._refreshMediaDevices,
function() {}, function() {
const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog');
Modal.createDialog(ErrorDialog, {
title: "No media permissions",
description: "You may need to manually permit Riot to access your microphone/webcam",
});
},
]); ]);
} }
}, },
@ -839,15 +844,17 @@ module.exports = React.createClass({
return <div> return <div>
<h3>WebRTC</h3> <h3>WebRTC</h3>
<div className="mx_UserSettings_section"> <div className="mx_UserSettings_section">
<h5 onClick={this._requestMediaPermissions}>Missing Media Permissions, click to request.</h5> <p className="mx_UserSettings_link" onClick={this._requestMediaPermissions}>
Missing Media Permissions, click here to request.
</p>
</div> </div>
</div>; </div>;
} else if (!this.state.mediaDevices) return; } else if (!this.state.mediaDevices) return;
const Dropdown = sdk.getComponent('elements.Dropdown'); const Dropdown = sdk.getComponent('elements.Dropdown');
let microphoneDropdown = <h5>No Microphones detected</h5>; let microphoneDropdown = <p>No Microphones detected</p>;
let webcamDropdown = <h5>No Webcams detected</h5>; let webcamDropdown = <p>No Webcams detected</p>;
const audioInputs = this.state.mediaDevices.audioinput; const audioInputs = this.state.mediaDevices.audioinput;
if ('default' in audioInputs) { if ('default' in audioInputs) {