Merge branch 'master' of git.flexites.org:Students/ITRadio
This commit is contained in:
commit
9635fab52a
|
|
@ -83,5 +83,8 @@ module.exports = {
|
|||
'vue/multi-word-component-names': 'off',
|
||||
// allow debugger during development only
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||
|
||||
// Custom
|
||||
// 'no-console': 'warn',
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -228,30 +228,30 @@ module.exports = configure(function (ctx) {
|
|||
theme_color: '#027be3',
|
||||
icons: [
|
||||
{
|
||||
src: 'icons/icon-128x128.png',
|
||||
sizes: '128x128',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'icons/icon-192x192.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'icons/icon-256x256.png',
|
||||
sizes: '256x256',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'icons/icon-384x384.png',
|
||||
sizes: '384x384',
|
||||
type: 'image/png',
|
||||
},
|
||||
{
|
||||
src: 'icons/icon-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
src: 'icons/favicon-16x16.svg',
|
||||
sizes: '16x16',
|
||||
type: 'svg',
|
||||
},
|
||||
// {
|
||||
// src: 'icons/icon-192x192.png',
|
||||
// sizes: '192x192',
|
||||
// type: 'image/png',
|
||||
// },
|
||||
// {
|
||||
// src: 'icons/icon-256x256.png',
|
||||
// sizes: '256x256',
|
||||
// type: 'image/png',
|
||||
// },
|
||||
// {
|
||||
// src: 'icons/icon-384x384.png',
|
||||
// sizes: '384x384',
|
||||
// type: 'image/png',
|
||||
// },
|
||||
// {
|
||||
// src: 'icons/icon-512x512.png',
|
||||
// sizes: '512x512',
|
||||
// type: 'image/png',
|
||||
// },
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -156,12 +156,11 @@ export default {
|
|||
},
|
||||
},
|
||||
created() {
|
||||
this.initializationInfo();
|
||||
// this.initializationInfo();
|
||||
this.connectionPlayer();
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('initPlayer');
|
||||
// console.log(this.$store.state);
|
||||
if (this.user?.id) {
|
||||
this.checkSongIsFavorite();
|
||||
this.getSongList();
|
||||
|
|
@ -193,14 +192,15 @@ export default {
|
|||
app
|
||||
.getNowplaying()
|
||||
.then((responce) => {
|
||||
console.log(responce.now_playing.song);
|
||||
const { art, title, artist } = responce.now_playing.song;
|
||||
console.log(art, title, artist);
|
||||
this.$store.dispatch('setCurrentPlay', {
|
||||
...this.currentPlay,
|
||||
isLoader: false,
|
||||
...responce.now_playing.song,
|
||||
art,
|
||||
title,
|
||||
artist,
|
||||
});
|
||||
console.log(this.player.target.src);
|
||||
// console.log(this.$store.state);
|
||||
})
|
||||
.catch((error) => console.log(error));
|
||||
},
|
||||
|
|
@ -209,9 +209,11 @@ export default {
|
|||
if (this.connection) {
|
||||
this.connection.removePlay();
|
||||
}
|
||||
|
||||
this.connection = new Player();
|
||||
this.connection.init();
|
||||
this.connection.onHandler(this.getPlaying);
|
||||
|
||||
this.connection.onHandler(this.handlePlayer);
|
||||
},
|
||||
checkSongIsFavorite() {
|
||||
app
|
||||
|
|
@ -234,30 +236,36 @@ export default {
|
|||
console.error(err);
|
||||
});
|
||||
},
|
||||
getPlaying(e) {
|
||||
handlePlayer(e) {
|
||||
// console.log('getPlaying', e);
|
||||
const jsonData = JSON.parse(e.data);
|
||||
if (jsonData?.pub?.data) {
|
||||
const data = jsonData?.pub?.data;
|
||||
if (this.currentPlay.live) {
|
||||
if (data.np.station.listen_url !== this.player.target.src) {
|
||||
console.log(
|
||||
'data.np.station.listen_url',
|
||||
data.np.station.listen_url,
|
||||
);
|
||||
this.$store.dispatch('changePlayer', data.np.station.listen_url);
|
||||
console.log(this.player);
|
||||
const params = {
|
||||
...this.currentPlay,
|
||||
...data.np.now_playing.song,
|
||||
azura_id: data.np.now_playing.song.id,
|
||||
isLoader: false,
|
||||
live: true,
|
||||
currentIndex: null,
|
||||
};
|
||||
delete params.unique_id;
|
||||
this.$store.dispatch('setCurrentPlay', params);
|
||||
console.log(this.$store.state);
|
||||
}
|
||||
// console.log('jsonData', jsonData);
|
||||
const data =
|
||||
// Второй ответ
|
||||
jsonData?.pub?.data ||
|
||||
// Первый ответ
|
||||
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
|
||||
// console.log('getPlaying', data);
|
||||
|
||||
if (!data) return;
|
||||
if (this.currentPlay.live) {
|
||||
const dataUrl = data.np.station.listen_url;
|
||||
const playerUrl = this.player.target.src;
|
||||
if (dataUrl !== playerUrl) {
|
||||
// console.log('data.np.station.listen_url', dataUrl);
|
||||
this.$store.dispatch('changePlayer', dataUrl);
|
||||
console.log(this.player);
|
||||
const params = {
|
||||
...this.currentPlay,
|
||||
...data.np.now_playing.song,
|
||||
azura_id: data.np.now_playing.song.id,
|
||||
isLoader: false,
|
||||
live: true,
|
||||
currentIndex: null,
|
||||
};
|
||||
console.log('params in getPlaying ', params);
|
||||
delete params.unique_id;
|
||||
this.$store.dispatch('setCurrentPlay', params);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -358,6 +366,7 @@ export default {
|
|||
app
|
||||
.getAudio(id)
|
||||
.then((res) => {
|
||||
console.log('res в методе getAudio', res);
|
||||
const blob = new Blob([res], { type: 'application/audio' });
|
||||
const audioUrl = URL.createObjectURL(blob);
|
||||
this.$store.dispatch('changePlayer', audioUrl);
|
||||
|
|
|
|||
|
|
@ -1,20 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="viewport" content="user-scalable=yes, initial-scale=1, maximum-scale=5, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#00a300">
|
||||
<meta name="theme-color" content="#119b58">
|
||||
</head>
|
||||
<body>
|
||||
<!-- DO NOT touch the following DIV -->
|
||||
<div id="q-app"></div>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<meta name="msapplication-tap-highlight" content="no" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="user-scalable=yes, initial-scale=1, maximum-scale=5, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>"
|
||||
/>
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/ico" href="favicon.ico" />
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/svg"
|
||||
sizes="16x16"
|
||||
href="icons/favicon-16x16.svg"
|
||||
/>
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
|
||||
<meta name="msapplication-TileColor" content="#00a300" />
|
||||
<meta name="theme-color" content="#119b58" />
|
||||
</head>
|
||||
<body>
|
||||
<!-- DO NOT touch the following DIV -->
|
||||
<div id="q-app"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ export default class extends REST {
|
|||
this.connection = new EventSource(
|
||||
sseBaseUri + '?' + sseUriParams.toString(),
|
||||
);
|
||||
// window.connection = this.connection;
|
||||
// this.connection.onopen = (e) => console.log('connected', e);
|
||||
}
|
||||
|
||||
removePlay() {
|
||||
|
|
@ -64,7 +66,6 @@ export default class extends REST {
|
|||
// return this._get(`station/${station}/playlists`, params, {}).then((data) => {
|
||||
return this._get(`radio.mp3`, params, {})
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
return data;
|
||||
})
|
||||
.catch((error) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue