|
@@ -225,11 +225,12 @@ const autoRequestSong = () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+const dateCurrently = () => new Date().getTime() + systemDifference.value;
|
|
const getTimeElapsed = () => {
|
|
const getTimeElapsed = () => {
|
|
if (currentSong.value) {
|
|
if (currentSong.value) {
|
|
if (stationPaused.value)
|
|
if (stationPaused.value)
|
|
- timePaused.value += Date.currently() - pausedAt.value;
|
|
|
|
- return Date.currently() - startedAt.value - timePaused.value;
|
|
|
|
|
|
+ timePaused.value += dateCurrently() - pausedAt.value;
|
|
|
|
+ return dateCurrently() - startedAt.value - timePaused.value;
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
};
|
|
};
|
|
@@ -273,9 +274,8 @@ const setNextCurrentSong = (_nextCurrentSong, skipSkipCheck = false) => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const resizeSeekerbar = () => {
|
|
const resizeSeekerbar = () => {
|
|
- seekerbarPercentage.value = parseFloat(
|
|
|
|
- (getTimeElapsed() / 1000 / currentSong.value.duration) * 100
|
|
|
|
- );
|
|
|
|
|
|
+ seekerbarPercentage.value =
|
|
|
|
+ (getTimeElapsed() / 1000 / currentSong.value.duration) * 100;
|
|
};
|
|
};
|
|
const calculateTimeElapsed = () => {
|
|
const calculateTimeElapsed = () => {
|
|
if (
|
|
if (
|
|
@@ -356,16 +356,16 @@ const calculateTimeElapsed = () => {
|
|
}
|
|
}
|
|
|
|
|
|
if (stationPaused.value)
|
|
if (stationPaused.value)
|
|
- timePaused.value += Date.currently() - pausedAt.value;
|
|
|
|
|
|
+ timePaused.value += dateCurrently() - pausedAt.value;
|
|
|
|
|
|
const duration =
|
|
const duration =
|
|
- (Date.currently() - startedAt.value - timePaused.value) / 1000;
|
|
|
|
|
|
+ (dateCurrently() - startedAt.value - timePaused.value) / 1000;
|
|
|
|
|
|
const songDuration = currentSong.value.duration;
|
|
const songDuration = currentSong.value.duration;
|
|
if (playerReady.value && songDuration <= duration)
|
|
if (playerReady.value && songDuration <= duration)
|
|
player.value.pauseVideo();
|
|
player.value.pauseVideo();
|
|
if (duration <= songDuration)
|
|
if (duration <= songDuration)
|
|
- timeElapsed.value = utils.formatTime(duration);
|
|
|
|
|
|
+ timeElapsed.value = utils.formatTime(duration) || "0";
|
|
};
|
|
};
|
|
const playVideo = () => {
|
|
const playVideo = () => {
|
|
if (playerReady.value) {
|
|
if (playerReady.value) {
|
|
@@ -384,7 +384,7 @@ const playVideo = () => {
|
|
}, 150);
|
|
}, 150);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-const voteSkipStation = message => {
|
|
|
|
|
|
+const voteSkipStation = (message?) => {
|
|
socket.dispatch("stations.voteSkip", station.value._id, data => {
|
|
socket.dispatch("stations.voteSkip", station.value._id, data => {
|
|
if (data.status !== "success") new Toast(`Error: ${data.message}`);
|
|
if (data.status !== "success") new Toast(`Error: ${data.message}`);
|
|
else
|
|
else
|
|
@@ -428,9 +428,7 @@ const youtubeReady = () => {
|
|
playVideo();
|
|
playVideo();
|
|
|
|
|
|
const duration =
|
|
const duration =
|
|
- (Date.currently() -
|
|
|
|
- startedAt.value -
|
|
|
|
- timePaused.value) /
|
|
|
|
|
|
+ (dateCurrently() - startedAt.value - timePaused.value) /
|
|
1000;
|
|
1000;
|
|
const songDuration = currentSong.value.duration;
|
|
const songDuration = currentSong.value.duration;
|
|
if (songDuration <= duration) player.value.pauseVideo();
|
|
if (songDuration <= duration) player.value.pauseVideo();
|
|
@@ -606,7 +604,7 @@ const setCurrentSong = data => {
|
|
!noSong.value &&
|
|
!noSong.value &&
|
|
_currentSong.value._id === _currentSong._id
|
|
_currentSong.value._id === _currentSong._id
|
|
)
|
|
)
|
|
- skipSong("window.stationNextSongTimeout 1");
|
|
|
|
|
|
+ skipSong();
|
|
}, getTimeRemaining());
|
|
}, getTimeRemaining());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -674,12 +672,12 @@ const setCurrentSong = data => {
|
|
};
|
|
};
|
|
const changeVolume = () => {
|
|
const changeVolume = () => {
|
|
const volume = volumeSliderValue.value;
|
|
const volume = volumeSliderValue.value;
|
|
- localStorage.setItem("volume", volume);
|
|
|
|
|
|
+ localStorage.setItem("volume", `${volume}`);
|
|
if (playerReady.value) {
|
|
if (playerReady.value) {
|
|
player.value.setVolume(volume);
|
|
player.value.setVolume(volume);
|
|
if (volume > 0) {
|
|
if (volume > 0) {
|
|
player.value.unMute();
|
|
player.value.unMute();
|
|
- localStorage.setItem("muted", false);
|
|
|
|
|
|
+ localStorage.setItem("muted", "false");
|
|
muted.value = false;
|
|
muted.value = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -733,10 +731,10 @@ const toggleMute = () => {
|
|
const previousVolume = parseFloat(localStorage.getItem("volume"));
|
|
const previousVolume = parseFloat(localStorage.getItem("volume"));
|
|
const volume = player.value.getVolume() <= 0 ? previousVolume : 0;
|
|
const volume = player.value.getVolume() <= 0 ? previousVolume : 0;
|
|
muted.value = !muted.value;
|
|
muted.value = !muted.value;
|
|
- localStorage.setItem("muted", muted.value);
|
|
|
|
|
|
+ localStorage.setItem("muted", `${muted.value}`);
|
|
volumeSliderValue.value = volume;
|
|
volumeSliderValue.value = volume;
|
|
player.value.setVolume(volume);
|
|
player.value.setVolume(volume);
|
|
- if (!muted.value) localStorage.setItem("volume", volume);
|
|
|
|
|
|
+ if (!muted.value) localStorage.setItem("volume", `${volume}`);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const increaseVolume = () => {
|
|
const increaseVolume = () => {
|
|
@@ -745,12 +743,12 @@ const increaseVolume = () => {
|
|
let volume = previousVolume + 5;
|
|
let volume = previousVolume + 5;
|
|
if (previousVolume === 0) {
|
|
if (previousVolume === 0) {
|
|
muted.value = false;
|
|
muted.value = false;
|
|
- localStorage.setItem("muted", false);
|
|
|
|
|
|
+ localStorage.setItem("muted", "false");
|
|
}
|
|
}
|
|
if (volume > 100) volume = 100;
|
|
if (volume > 100) volume = 100;
|
|
volumeSliderValue.value = volume;
|
|
volumeSliderValue.value = volume;
|
|
player.value.setVolume(volume);
|
|
player.value.setVolume(volume);
|
|
- localStorage.setItem("volume", volume);
|
|
|
|
|
|
+ localStorage.setItem("volume", `${volume}`);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const toggleLike = () => {
|
|
const toggleLike = () => {
|
|
@@ -1026,8 +1024,9 @@ const sendActivityWatchVideoData = () => {
|
|
if (!stationPaused.value && !localPaused.value && !noSong.value) {
|
|
if (!stationPaused.value && !localPaused.value && !noSong.value) {
|
|
if (activityWatchVideoLastStatus.value !== "playing") {
|
|
if (activityWatchVideoLastStatus.value !== "playing") {
|
|
activityWatchVideoLastStatus.value = "playing";
|
|
activityWatchVideoLastStatus.value = "playing";
|
|
- activityWatchVideoLastStatus.value =
|
|
|
|
- currentSong.value.skipDuration + getTimeElapsed();
|
|
|
|
|
|
+ activityWatchVideoLastStatus.value = `${
|
|
|
|
+ currentSong.value.skipDuration + getTimeElapsed()
|
|
|
|
+ }`;
|
|
}
|
|
}
|
|
|
|
|
|
if (
|
|
if (
|
|
@@ -1035,8 +1034,9 @@ const sendActivityWatchVideoData = () => {
|
|
currentSong.value.youtubeId
|
|
currentSong.value.youtubeId
|
|
) {
|
|
) {
|
|
activityWatchVideoLastYouTubeId.value = currentSong.value.youtubeId;
|
|
activityWatchVideoLastYouTubeId.value = currentSong.value.youtubeId;
|
|
- activityWatchVideoLastStatus.value =
|
|
|
|
- currentSong.value.skipDuration + getTimeElapsed();
|
|
|
|
|
|
+ activityWatchVideoLastStatus.value = `${
|
|
|
|
+ currentSong.value.skipDuration + getTimeElapsed()
|
|
|
|
+ }`;
|
|
}
|
|
}
|
|
|
|
|
|
const videoData = {
|
|
const videoData = {
|
|
@@ -1049,9 +1049,11 @@ const sendActivityWatchVideoData = () => {
|
|
muted: muted.value,
|
|
muted: muted.value,
|
|
volume: volumeSliderValue.value,
|
|
volume: volumeSliderValue.value,
|
|
startedDuration:
|
|
startedDuration:
|
|
- activityWatchVideoLastStatus.value <= 0
|
|
|
|
|
|
+ Number(activityWatchVideoLastStatus.value) <= 0
|
|
? 0
|
|
? 0
|
|
- : Math.floor(activityWatchVideoLastStatus.value / 1000),
|
|
|
|
|
|
+ : Math.floor(
|
|
|
|
+ Number(activityWatchVideoLastStatus.value) / 1000
|
|
|
|
+ ),
|
|
source: `station#${station.value.name}`,
|
|
source: `station#${station.value.name}`,
|
|
hostname: window.location.hostname
|
|
hostname: window.location.hostname
|
|
};
|
|
};
|
|
@@ -1097,8 +1099,6 @@ onMounted(async () => {
|
|
|
|
|
|
window.scrollTo(0, 0);
|
|
window.scrollTo(0, 0);
|
|
|
|
|
|
- Date.currently = () => new Date().getTime() + systemDifference.value;
|
|
|
|
-
|
|
|
|
stationIdentifier.value = route.params.id;
|
|
stationIdentifier.value = route.params.id;
|
|
|
|
|
|
window.stationInterval = 0;
|
|
window.stationInterval = 0;
|
|
@@ -1120,7 +1120,7 @@ onMounted(async () => {
|
|
|
|
|
|
ws.onDisconnect(true, () => {
|
|
ws.onDisconnect(true, () => {
|
|
socketConnected.value = false;
|
|
socketConnected.value = false;
|
|
- const _currentSong = currentSong.value.currentSong;
|
|
|
|
|
|
+ const _currentSong = currentSong.value;
|
|
if (nextSong.value)
|
|
if (nextSong.value)
|
|
setNextCurrentSong(
|
|
setNextCurrentSong(
|
|
{
|
|
{
|
|
@@ -1144,7 +1144,7 @@ onMounted(async () => {
|
|
);
|
|
);
|
|
window.stationNextSongTimeout = setTimeout(() => {
|
|
window.stationNextSongTimeout = setTimeout(() => {
|
|
if (!noSong.value && currentSong.value._id === _currentSong._id)
|
|
if (!noSong.value && currentSong.value._id === _currentSong._id)
|
|
- skipSong("window.stationNextSongTimeout 2");
|
|
|
|
|
|
+ skipSong();
|
|
}, getTimeRemaining());
|
|
}, getTimeRemaining());
|
|
});
|
|
});
|
|
|
|
|
|
@@ -1301,7 +1301,9 @@ onMounted(async () => {
|
|
key =>
|
|
key =>
|
|
`${encodeURIComponent(
|
|
`${encodeURIComponent(
|
|
key
|
|
key
|
|
- )}=${encodeURIComponent(route.query[key])}`
|
|
|
|
|
|
+ )}=${encodeURIComponent(
|
|
|
|
+ JSON.stringify(route.query[key])
|
|
|
|
+ )}`
|
|
)
|
|
)
|
|
.join("&")}`
|
|
.join("&")}`
|
|
);
|
|
);
|
|
@@ -1345,7 +1347,7 @@ onMounted(async () => {
|
|
let volume = parseFloat(localStorage.getItem("volume"));
|
|
let volume = parseFloat(localStorage.getItem("volume"));
|
|
volume =
|
|
volume =
|
|
typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
|
|
typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
|
|
- localStorage.setItem("volume", volume);
|
|
|
|
|
|
+ localStorage.setItem("volume", `${volume}`);
|
|
volumeSliderValue.value = volume;
|
|
volumeSliderValue.value = volume;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -2008,8 +2010,7 @@ onBeforeUnmount(() => {
|
|
<span
|
|
<span
|
|
><b>Skip votes current</b>:
|
|
><b>Skip votes current</b>:
|
|
{{
|
|
{{
|
|
- currentSong.skipVotesCurrent === true ||
|
|
|
|
- currentSong.skipVotesCurrent === false
|
|
|
|
|
|
+ currentSong.skipVotesCurrent
|
|
? currentSong.skipVotesCurrent
|
|
? currentSong.skipVotesCurrent
|
|
: "N/A"
|
|
: "N/A"
|
|
}}</span
|
|
}}</span
|