|
@@ -93,10 +93,10 @@ const volumeSliderValue = ref(0);
|
|
const showPlaylistDropdown = ref(false);
|
|
const showPlaylistDropdown = ref(false);
|
|
const seekerbarPercentage = ref(0);
|
|
const seekerbarPercentage = ref(0);
|
|
const frontendDevMode = ref("production");
|
|
const frontendDevMode = ref("production");
|
|
-const activityWatchVideoDataInterval = ref(null);
|
|
|
|
-const activityWatchVideoLastStatus = ref("");
|
|
|
|
-const activityWatchVideoLastYouTubeId = ref("");
|
|
|
|
-const activityWatchVideoLastStartDuration = ref(0);
|
|
|
|
|
|
+const activityWatchMediaDataInterval = ref(null);
|
|
|
|
+const activityWatchMediaLastStatus = ref("");
|
|
|
|
+const activityWatchMediaLastMediaSource = ref("");
|
|
|
|
+const activityWatchMediaLastStartDuration = ref(0);
|
|
const reportStationStateInterval = ref(null);
|
|
const reportStationStateInterval = ref(null);
|
|
const nextCurrentSong = ref(null);
|
|
const nextCurrentSong = ref(null);
|
|
const mediaModalWatcher = ref(null);
|
|
const mediaModalWatcher = ref(null);
|
|
@@ -1044,31 +1044,31 @@ const toggleKeyboardShortcutsHelper = () => {
|
|
const resetKeyboardShortcutsHelper = () => {
|
|
const resetKeyboardShortcutsHelper = () => {
|
|
keyboardShortcutsHelper.value.resetBox();
|
|
keyboardShortcutsHelper.value.resetBox();
|
|
};
|
|
};
|
|
-const sendActivityWatchVideoData = () => {
|
|
|
|
|
|
+const sendActivityWatchMediaData = () => {
|
|
// TODO have this support soundcloud
|
|
// TODO have this support soundcloud
|
|
if (
|
|
if (
|
|
- currentSongMediaType.value === "youtube" &&
|
|
|
|
!stationPaused.value &&
|
|
!stationPaused.value &&
|
|
(!localPaused.value ||
|
|
(!localPaused.value ||
|
|
experimentalChangableListenMode.value === "participate") &&
|
|
experimentalChangableListenMode.value === "participate") &&
|
|
!noSong.value &&
|
|
!noSong.value &&
|
|
(experimentalChangableListenMode.value === "participate" ||
|
|
(experimentalChangableListenMode.value === "participate" ||
|
|
|
|
+ currentSongMediaType.value !== "youtube" ||
|
|
youtubePlayer.value.getPlayerState() ===
|
|
youtubePlayer.value.getPlayerState() ===
|
|
window.YT.PlayerState.PLAYING)
|
|
window.YT.PlayerState.PLAYING)
|
|
) {
|
|
) {
|
|
- if (activityWatchVideoLastStatus.value !== "playing") {
|
|
|
|
- activityWatchVideoLastStatus.value = "playing";
|
|
|
|
- activityWatchVideoLastStartDuration.value =
|
|
|
|
|
|
+ if (activityWatchMediaLastStatus.value !== "playing") {
|
|
|
|
+ activityWatchMediaLastStatus.value = "playing";
|
|
|
|
+ activityWatchMediaLastStartDuration.value =
|
|
currentSong.value.skipDuration + getTimeElapsed();
|
|
currentSong.value.skipDuration + getTimeElapsed();
|
|
}
|
|
}
|
|
|
|
|
|
if (
|
|
if (
|
|
- activityWatchVideoLastYouTubeId.value !==
|
|
|
|
|
|
+ activityWatchMediaLastMediaSource.value !==
|
|
currentSong.value.mediaSource
|
|
currentSong.value.mediaSource
|
|
) {
|
|
) {
|
|
- activityWatchVideoLastYouTubeId.value =
|
|
|
|
|
|
+ activityWatchMediaLastMediaSource.value =
|
|
currentSong.value.mediaSource;
|
|
currentSong.value.mediaSource;
|
|
- activityWatchVideoLastStartDuration.value =
|
|
|
|
|
|
+ activityWatchMediaLastStartDuration.value =
|
|
currentSong.value.skipDuration + getTimeElapsed();
|
|
currentSong.value.skipDuration + getTimeElapsed();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1082,29 +1082,38 @@ const sendActivityWatchVideoData = () => {
|
|
muted: muted.value,
|
|
muted: muted.value,
|
|
volume: volumeSliderValue.value,
|
|
volume: volumeSliderValue.value,
|
|
startedDuration:
|
|
startedDuration:
|
|
- activityWatchVideoLastStartDuration.value <= 0
|
|
|
|
|
|
+ activityWatchMediaLastStartDuration.value <= 0
|
|
? 0
|
|
? 0
|
|
: Math.floor(
|
|
: Math.floor(
|
|
- activityWatchVideoLastStartDuration.value / 1000
|
|
|
|
|
|
+ activityWatchMediaLastStartDuration.value / 1000
|
|
),
|
|
),
|
|
source: `station#${station.value.name}`,
|
|
source: `station#${station.value.name}`,
|
|
hostname: window.location.hostname,
|
|
hostname: window.location.hostname,
|
|
- playerState:
|
|
|
|
|
|
+ experimentalChangableListenMode:
|
|
|
|
+ experimentalChangableListenMode.value,
|
|
|
|
+ playerState: "",
|
|
|
|
+ playbackRate: -1
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ if (currentSongMediaType.value === "youtube") {
|
|
|
|
+ videoData.playerState =
|
|
experimentalChangableListenMode.value === "participate"
|
|
experimentalChangableListenMode.value === "participate"
|
|
? "none"
|
|
? "none"
|
|
: Object.keys(window.YT.PlayerState).find(
|
|
: Object.keys(window.YT.PlayerState).find(
|
|
key =>
|
|
key =>
|
|
window.YT.PlayerState[key] ===
|
|
window.YT.PlayerState[key] ===
|
|
youtubePlayer.value.getPlayerState()
|
|
youtubePlayer.value.getPlayerState()
|
|
- ),
|
|
|
|
- playbackRate: playbackRate.value,
|
|
|
|
- experimentalChangableListenMode:
|
|
|
|
- experimentalChangableListenMode.value
|
|
|
|
- };
|
|
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ videoData.playbackRate = playbackRate.value;
|
|
|
|
+ } else {
|
|
|
|
+ delete videoData.playerState;
|
|
|
|
+ delete videoData.playbackRate;
|
|
|
|
+ }
|
|
|
|
|
|
- aw.sendVideoData(videoData);
|
|
|
|
|
|
+ aw.sendMediaData(videoData);
|
|
} else {
|
|
} else {
|
|
- activityWatchVideoLastStatus.value = "not_playing";
|
|
|
|
|
|
+ activityWatchMediaLastStatus.value = "not_playing";
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1163,8 +1172,8 @@ onMounted(async () => {
|
|
stationIdentifier.value = route.params.id;
|
|
stationIdentifier.value = route.params.id;
|
|
|
|
|
|
window.stationInterval = 0;
|
|
window.stationInterval = 0;
|
|
- activityWatchVideoDataInterval.value = setInterval(() => {
|
|
|
|
- sendActivityWatchVideoData();
|
|
|
|
|
|
+ activityWatchMediaDataInterval.value = setInterval(() => {
|
|
|
|
+ sendActivityWatchMediaData();
|
|
}, 1000);
|
|
}, 1000);
|
|
reportStationStateInterval.value = setInterval(() => {
|
|
reportStationStateInterval.value = setInterval(() => {
|
|
socket.dispatch(
|
|
socket.dispatch(
|
|
@@ -1851,7 +1860,7 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
mediaModalWatcher.value(); // removes the watcher
|
|
mediaModalWatcher.value(); // removes the watcher
|
|
|
|
|
|
- clearInterval(activityWatchVideoDataInterval.value);
|
|
|
|
|
|
+ clearInterval(activityWatchMediaDataInterval.value);
|
|
clearTimeout(window.stationNextSongTimeout);
|
|
clearTimeout(window.stationNextSongTimeout);
|
|
clearTimeout(persistentToastCheckerInterval.value);
|
|
clearTimeout(persistentToastCheckerInterval.value);
|
|
clearInterval(reportStationStateInterval.value);
|
|
clearInterval(reportStationStateInterval.value);
|