fix change player volume

This commit is contained in:
Jonas Heinrich 2020-10-25 10:23:31 +01:00
parent 8154e5d67b
commit cfbd9403ba
5 changed files with 16 additions and 26 deletions

View File

@ -1,9 +1,3 @@
<template> <template>
<router-view /> <router-view />
</template> </template>
<style lang="scss">
:root {
--icon-play: url('./assets/play.png');
}
</style>

View File

@ -1,6 +1,6 @@
<template> <template>
<Content app-name="radio"> <Content app-name="radio">
<Navigation @changeVolume="changeVolume" /> <Navigation />
<AppContent> <AppContent>
<Breadcrumbs class="breadcrumbs"> <Breadcrumbs class="breadcrumbs">
<Breadcrumb title="Home" href="/" /> <Breadcrumb title="Home" href="/" />
@ -60,6 +60,11 @@ export default {
}, },
watch: { watch: {
$route: 'onRoute', $route: 'onRoute',
'player.volume'(newVolume, oldVolume) {
if (audioPlayer !== null) {
audioPlayer.volume(newVolume)
}
},
}, },
mounted() { mounted() {
this.loadStations() this.loadStations()
@ -164,7 +169,6 @@ export default {
'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work 'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work
}) })
.done(function(data) { .done(function(data) {
vm.pageLoading = false
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const obj = data[i] const obj = data[i]
let blurHash = vm.blurHashes[obj.stationuuid] let blurHash = vm.blurHashes[obj.stationuuid]
@ -173,9 +177,9 @@ export default {
} }
data[i].blurHash = blurHash data[i].blurHash = blurHash
} }
console.log(data)
vm.tableData = vm.tableData.concat(data) vm.tableData = vm.tableData.concat(data)
vm.offset += 20 vm.offset += 20
vm.pageLoading = false
}) })
}, },
/** /**
@ -188,11 +192,6 @@ export default {
} }
} }
}, },
changeVolume(volume) {
if (audioPlayer !== null) {
audioPlayer.volume(volume)
}
},
}, },
} }
</script> </script>

View File

@ -20,8 +20,7 @@
</template> </template>
<template #footer> <template #footer>
<Player <Player
:pinned="true" :pinned="true" />
@changeVolume="changeVolume" />
</template> </template>
</AppNavigation> </AppNavigation>
</template> </template>
@ -38,11 +37,6 @@ export default {
AppNavigationItem, AppNavigationItem,
Player, Player,
}, },
methods: {
changeVolume(volume) {
this.$emit('changeVolume', volume)
},
},
} }
</script> </script>

View File

@ -16,7 +16,7 @@
max="1" max="1"
step=".05" step=".05"
:value="player.volume" :value="player.volume"
@input="changeVolume"> @input="changeVolume($event)">
<span class="stationMetadata" /> <span class="stationMetadata" />
{{ player.volume }} {{ player.volume }}
</div> </div>
@ -24,9 +24,6 @@
<script> <script>
export default { export default {
data: () => ({
sliderVal: 0,
}),
computed: { computed: {
player() { player() {
return this.$store.state.player return this.$store.state.player
@ -34,7 +31,7 @@ export default {
}, },
methods: { methods: {
changeVolume() { changeVolume() {
this.$emit('changeVolume', this.sliderVal) this.$store.dispatch('changeVolume', event.target.value)
}, },
}, },
} }

View File

@ -17,6 +17,9 @@ export default new Vuex.Store({
isBuffering(state, bufferingState) { isBuffering(state, bufferingState) {
state.player.isBuffering = bufferingState state.player.isBuffering = bufferingState
}, },
changeVolume(state, volume) {
state.player.volume = volume
},
}, },
actions: { actions: {
isPlaying(context, playerState) { isPlaying(context, playerState) {
@ -25,5 +28,8 @@ export default new Vuex.Store({
isBuffering(context, bufferingState) { isBuffering(context, bufferingState) {
context.commit('isBuffering', bufferingState) context.commit('isBuffering', bufferingState)
}, },
changeVolume(context, volume) {
context.commit('changeVolume', volume)
},
}, },
}) })