fix: open microphone whenever enter setting page | 删除获取麦克风权限 (#350)

* fix: bugs

* delete getMediaUser

Co-authored-by: qier222 <qier222@outlook.com>
master
Vidocq 4 years ago committed by GitHub
parent ee77b34ee9
commit fc0367c9b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -119,7 +119,6 @@ export default {
lossless: "Lossless", lossless: "Lossless",
}, },
deviceSelector: "Audio Output Device", deviceSelector: "Audio Output Device",
permissionDenied: "Microphone Permission Denied",
permissionRequired: "Microphone Permission Required", permissionRequired: "Microphone Permission Required",
appearance: { appearance: {
text: "Appearance", text: "Appearance",

@ -120,7 +120,6 @@ export default {
lossless: "无损", lossless: "无损",
}, },
deviceSelector: "音频输出设备", deviceSelector: "音频输出设备",
permissionDenied: "无麦克风权限",
permissionRequired: "需要麦克风权限", permissionRequired: "需要麦克风权限",
appearance: { appearance: {
text: "外观", text: "外观",

@ -401,26 +401,23 @@ export default {
}, },
methods: { methods: {
getAllOutputDevices() { getAllOutputDevices() {
navigator.mediaDevices navigator.mediaDevices.enumerateDevices().then((devices) => {
.getUserMedia({ audio: true }) this.allOutputDevices = devices.filter((device) => {
.then(() => { return device.kind == "audiooutput";
});
if (
this.allOutputDevices.length > 0 &&
this.allOutputDevices[0].label !== ""
) {
this.withoutAudioPriviledge = false; this.withoutAudioPriviledge = false;
navigator.mediaDevices } else {
.enumerateDevices()
.then(
(devices) =>
(this.allOutputDevices = devices.filter(
(device) => device.kind == "audiooutput"
))
);
})
.catch(() => {
this.allOutputDevices = [ this.allOutputDevices = [
{ {
deviceId: "default", deviceId: "default",
label: "settings.permissionDenied", label: "settings.permissionRequired",
}, },
]; ];
}
}); });
}, },
logout() { logout() {

Loading…
Cancel
Save