получение данных о треке перед подключением стрима
This commit is contained in:
parent
f5725e085b
commit
21481aca98
|
|
@ -157,10 +157,11 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.connectionPlayer();
|
this.connectionPlayer();
|
||||||
|
this.initializationInfo();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initializationInfo();
|
|
||||||
this.$store.dispatch('initPlayer');
|
this.$store.dispatch('initPlayer');
|
||||||
|
// console.log(this.$store.state);
|
||||||
if (this.user?.id) {
|
if (this.user?.id) {
|
||||||
this.checkSongIsFavorite();
|
this.checkSongIsFavorite();
|
||||||
this.getSongList();
|
this.getSongList();
|
||||||
|
|
@ -189,8 +190,13 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async initializationInfo() {
|
async initializationInfo() {
|
||||||
return app.getNowplaying().then((responce) => responce.now_playing.song);
|
return app.getNowplaying().then((responce) => {
|
||||||
|
console.log(responce.now_playing.song);
|
||||||
|
this.$store.dispatch('setCurrentPlay', responce.now_playing.song);
|
||||||
|
console.log(this.$store.state);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
connectionPlayer() {
|
connectionPlayer() {
|
||||||
if (this.connection) {
|
if (this.connection) {
|
||||||
this.connection.removePlay();
|
this.connection.removePlay();
|
||||||
|
|
@ -241,6 +247,7 @@ export default {
|
||||||
};
|
};
|
||||||
delete params.unique_id;
|
delete params.unique_id;
|
||||||
this.$store.dispatch('setCurrentPlay', params);
|
this.$store.dispatch('setCurrentPlay', params);
|
||||||
|
console.log(this.$store.state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ export default class extends REST {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onHandler(event) {
|
onHandler(callback) {
|
||||||
this.connection.onmessage = event;
|
this.connection.onmessage = callback;
|
||||||
}
|
}
|
||||||
static getPlayList(station, params) {
|
static getPlayList(station, params) {
|
||||||
// return this._get(`station/${station}/playlists`, params, {}).then((data) => {
|
// return this._get(`station/${station}/playlists`, params, {}).then((data) => {
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,4 @@ const robotsTxt = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
console.log(urlPath);
|
|
||||||
export { selfUrl, ajax, cache, urlPath, urlPathAudio, selfPath, robotsTxt };
|
export { selfUrl, ajax, cache, urlPath, urlPathAudio, selfPath, robotsTxt };
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ export default createStore({
|
||||||
state.player = { ...state.player, ...params };
|
state.player = { ...state.player, ...params };
|
||||||
},
|
},
|
||||||
initPlayer(state) {
|
initPlayer(state) {
|
||||||
|
// console.log('mutation initPlayer', state);
|
||||||
state.player.target = document.createElement('audio');
|
state.player.target = document.createElement('audio');
|
||||||
state.player.target.src = '';
|
state.player.target.src = '';
|
||||||
state.player.target.preload = 'auto';
|
state.player.target.preload = 'auto';
|
||||||
|
|
@ -126,6 +127,7 @@ export default createStore({
|
||||||
context.commit('setPlayer', params);
|
context.commit('setPlayer', params);
|
||||||
},
|
},
|
||||||
initPlayer(context) {
|
initPlayer(context) {
|
||||||
|
// console.log('action initPlayer');
|
||||||
context.commit('initPlayer');
|
context.commit('initPlayer');
|
||||||
},
|
},
|
||||||
handlerPlayer(context, params) {
|
handlerPlayer(context, params) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue