beginning to implement player metadata

This commit is contained in:
Jonas Heinrich 2020-10-26 16:41:58 +01:00
parent 0afb670d16
commit a5ebe54a80
3 changed files with 17 additions and 7 deletions

View File

@ -126,6 +126,7 @@ export default {
if (audioPlayer !== null) { if (audioPlayer !== null) {
audioPlayer.fade(vm.player.volume, 0, 500) audioPlayer.fade(vm.player.volume, 0, 500)
} }
vm.$store.dispatch('setTitle', station.name)
this.$jquery.get('http://de1.api.radio-browser.info/json/url/' + station.stationuuid, this.$jquery.get('http://de1.api.radio-browser.info/json/url/' + station.stationuuid,
{ {
'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
@ -165,7 +166,6 @@ export default {
* Fetching radio stations using Radio-Browser.info API * Fetching radio stations using Radio-Browser.info API
*/ */
loadStations() { loadStations() {
// FIXME https://de1.api.radio-browser.info/json/stations/lastchange?limit=10
const vm = this const vm = this
if (vm.offset === 0) { if (vm.offset === 0) {
vm.pageLoading = true vm.pageLoading = true

View File

@ -21,7 +21,9 @@
step=".05" step=".05"
:value="player.volume" :value="player.volume"
@input="changeVolume($event)"> @input="changeVolume($event)">
<span class="stationMetadata" /> <span class="playerMetadata">
{{ player.title }}
</span>
</div> </div>
</template> </template>
@ -93,11 +95,12 @@ export default {
} }
} }
.station_metadata{ .playerMetadata{
margin: 2px 20px 5px 20px;
padding-left: 5px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
background: red;
position: relative;
} }
.volumeIcon { .volumeIcon {

View File

@ -11,6 +11,7 @@ export default new Vuex.Store({
isPaused: false, isPaused: false,
volume: 0, volume: 0,
oldVolume: 0, oldVolume: 0,
title: 'test',
}, },
}, },
mutations: { mutations: {
@ -42,6 +43,9 @@ export default new Vuex.Store({
state.player.isPaused = false state.player.isPaused = false
} }
}, },
setTitle(state, title) {
state.player.title = title
},
}, },
actions: { actions: {
isPlaying(context, playerState) { isPlaying(context, playerState) {
@ -59,5 +63,8 @@ export default new Vuex.Store({
togglePlay(context) { togglePlay(context) {
context.commit('togglePlay') context.commit('togglePlay')
}, },
setTitle(context, title) {
context.commit('setTitle', title)
},
}, },
}) })