|
|
|
@ -74,6 +74,23 @@
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="item">
|
|
|
|
|
<div class="left">
|
|
|
|
|
<div class="title"> {{ $t("settings.deviceSelector") }} </div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="right">
|
|
|
|
|
<select v-model="outputDevice">
|
|
|
|
|
<option
|
|
|
|
|
v-for="device in allOutputDevices"
|
|
|
|
|
:key="device.deviceId"
|
|
|
|
|
:value="device.deviceId"
|
|
|
|
|
:selected="device.deviceId == outputDevice"
|
|
|
|
|
>
|
|
|
|
|
{{ device.label }}
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="item">
|
|
|
|
|
<div class="left">
|
|
|
|
|
<div class="title">
|
|
|
|
@ -227,10 +244,11 @@ export default {
|
|
|
|
|
size: "0KB",
|
|
|
|
|
length: 0,
|
|
|
|
|
},
|
|
|
|
|
allOutputDevices: [],
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapState(["settings", "data"]),
|
|
|
|
|
...mapState(["player", "settings", "data"]),
|
|
|
|
|
isElectron() {
|
|
|
|
|
return process.env.IS_ELECTRON;
|
|
|
|
|
},
|
|
|
|
@ -270,6 +288,26 @@ export default {
|
|
|
|
|
this.clearCache("tracks");
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
outputDevice: {
|
|
|
|
|
get() {
|
|
|
|
|
if (this.allOutputDevices.length == 0) this.getAllOutputDevices(); // Ensure devices loaded before get
|
|
|
|
|
const isValidDevice = this.allOutputDevices.find(
|
|
|
|
|
(device) => device.deviceId === this.settings.outputDevice
|
|
|
|
|
);
|
|
|
|
|
if (
|
|
|
|
|
this.settings.outputDevice === undefined ||
|
|
|
|
|
isValidDevice === undefined
|
|
|
|
|
)
|
|
|
|
|
return "default"; // Default deviceId
|
|
|
|
|
return this.settings.outputDevice;
|
|
|
|
|
},
|
|
|
|
|
set(deviceId) {
|
|
|
|
|
if (deviceId === this.settings.outputDevice || deviceId === undefined)
|
|
|
|
|
return;
|
|
|
|
|
this.$store.commit("changeOutputDevice", deviceId);
|
|
|
|
|
this.player.setOutputDevice();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
showGithubIcon: {
|
|
|
|
|
get() {
|
|
|
|
|
if (this.settings.showGithubIcon === undefined) return true;
|
|
|
|
@ -356,6 +394,16 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getAllOutputDevices() {
|
|
|
|
|
return navigator.mediaDevices
|
|
|
|
|
.enumerateDevices()
|
|
|
|
|
.then(
|
|
|
|
|
(devices) =>
|
|
|
|
|
(this.allOutputDevices = devices.filter(
|
|
|
|
|
(device) => device.kind == "audiooutput"
|
|
|
|
|
))
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
logout() {
|
|
|
|
|
doLogout();
|
|
|
|
|
this.$router.push({ name: "home" });
|
|
|
|
|