index.vue 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058
  1. <script setup lang="ts">
  2. import {
  3. defineAsyncComponent,
  4. ref,
  5. computed,
  6. watch,
  7. onMounted,
  8. onBeforeUnmount
  9. } from "vue";
  10. import { useRoute, useRouter } from "vue-router";
  11. import Toast from "toasters";
  12. import { storeToRefs } from "pinia";
  13. import { ContentLoader } from "vue-content-loader";
  14. import canAutoPlay from "can-autoplay";
  15. import { useWebsocketsStore } from "@/stores/websockets";
  16. import { useStationStore } from "@/stores/station";
  17. import { useUserAuthStore } from "@/stores/userAuth";
  18. import { useUserPreferencesStore } from "@/stores/userPreferences";
  19. import { useModalsStore } from "@/stores/modals";
  20. import aw from "@/aw";
  21. import ms from "@/ms";
  22. import keyboardShortcuts from "@/keyboardShortcuts";
  23. import utils from "@/utils";
  24. const MainHeader = defineAsyncComponent(
  25. () => import("@/components/MainHeader.vue")
  26. );
  27. const MainFooter = defineAsyncComponent(
  28. () => import("@/components/MainFooter.vue")
  29. );
  30. const FloatingBox = defineAsyncComponent(
  31. () => import("@/components/FloatingBox.vue")
  32. );
  33. const StationInfoBox = defineAsyncComponent(
  34. () => import("@/components/StationInfoBox.vue")
  35. );
  36. const AddToPlaylistDropdown = defineAsyncComponent(
  37. () => import("@/components/AddToPlaylistDropdown.vue")
  38. );
  39. const SongItem = defineAsyncComponent(
  40. () => import("@/components/SongItem.vue")
  41. );
  42. const Z404 = defineAsyncComponent(() => import("@/pages/404.vue"));
  43. const StationSidebar = defineAsyncComponent(
  44. () => import("./Sidebar/index.vue")
  45. );
  46. const route = useRoute();
  47. const router = useRouter();
  48. const { socket } = useWebsocketsStore();
  49. const stationStore = useStationStore();
  50. const userAuthStore = useUserAuthStore();
  51. const userPreferencesStore = useUserPreferencesStore();
  52. // TODO this might need a different place, like onMounted
  53. const isApple = ref(
  54. navigator.platform.match(/iPhone|iPod|iPad/) ||
  55. navigator.vendor === "Apple Computer, Inc."
  56. );
  57. const loading = ref(true);
  58. const exists = ref(true);
  59. const playerReady = ref(false);
  60. const player = ref(undefined);
  61. const timePaused = ref(0);
  62. const muted = ref(false);
  63. const timeElapsed = ref("0:00");
  64. const timeBeforePause = ref(0);
  65. const systemDifference = ref(0);
  66. const attemptsToPlayVideo = ref(0);
  67. const canAutoplay = ref(true);
  68. const lastTimeRequestedIfCanAutoplay = ref(0);
  69. const seeking = ref(false);
  70. const playbackRate = ref(1);
  71. const volumeSliderValue = ref(0);
  72. const showPlaylistDropdown = ref(false);
  73. const seekerbarPercentage = ref(0);
  74. const frontendDevMode = ref("production");
  75. const activityWatchVideoDataInterval = ref(null);
  76. const activityWatchVideoLastStatus = ref("");
  77. const activityWatchVideoLastYouTubeId = ref("");
  78. const activityWatchVideoLastStartDuration = ref(0);
  79. const nextCurrentSong = ref(null);
  80. const mediaModalWatcher = ref(null);
  81. const beforeMediaModalLocalPausedLock = ref(false);
  82. const beforeMediaModalLocalPaused = ref(null);
  83. const persistentToastCheckerInterval = ref(null);
  84. const persistentToasts = ref([]);
  85. const mediasession = ref(false);
  86. const christmas = ref(false);
  87. const sitename = ref("Musare");
  88. // Experimental options
  89. const experimentalChangableListenModeEnabled = ref(false);
  90. const experimentalChangableListenMode = ref("listen_and_participate"); // Can be either listen_and_participate or participate
  91. // End experimental options
  92. // NEW
  93. const videoLoading = ref();
  94. const startedAt = ref();
  95. const pausedAt = ref();
  96. const stationIdentifier = ref();
  97. // ENDNEW
  98. const playerDebugBox = ref();
  99. const keyboardShortcutsHelper = ref();
  100. const modalsStore = useModalsStore();
  101. const { activeModals } = storeToRefs(modalsStore);
  102. // TODO fix this if it still has some use, as this is no longer accurate
  103. // const video = computed(() => store.state.modals.editSong);
  104. const { loggedIn, userId } = storeToRefs(userAuthStore);
  105. const { nightmode, autoSkipDisliked } = storeToRefs(userPreferencesStore);
  106. const {
  107. station,
  108. currentSong,
  109. nextSong,
  110. songsList,
  111. stationPaused,
  112. localPaused,
  113. noSong,
  114. autoRequest,
  115. autoRequestLock
  116. } = storeToRefs(stationStore);
  117. const skipVotesLoaded = computed(
  118. () =>
  119. !noSong.value &&
  120. Number.isInteger(currentSong.value.skipVotes) &&
  121. currentSong.value.skipVotes >= 0
  122. );
  123. const ratingsLoaded = computed(
  124. () =>
  125. !noSong.value &&
  126. Number.isInteger(currentSong.value.likes) &&
  127. Number.isInteger(currentSong.value.dislikes) &&
  128. currentSong.value.likes >= 0 &&
  129. currentSong.value.dislikes >= 0
  130. );
  131. const ownRatingsLoaded = computed(
  132. () =>
  133. !noSong.value &&
  134. typeof currentSong.value.liked === "boolean" &&
  135. typeof currentSong.value.disliked === "boolean"
  136. );
  137. const aModalIsOpen = computed(() => Object.keys(activeModals.value).length > 0);
  138. const currentUserQueueSongs = computed(
  139. () =>
  140. songsList.value.filter(
  141. queueSong => queueSong.requestedBy === userId.value
  142. ).length
  143. );
  144. const {
  145. joinStation,
  146. leaveStation,
  147. updateStation,
  148. updateUserCount,
  149. updateUsers,
  150. updateCurrentSong,
  151. updateNextSong,
  152. updateSongsList,
  153. repositionSongInList,
  154. updateStationPaused,
  155. updateLocalPaused,
  156. updateNoSong,
  157. updateIfStationIsFavorited,
  158. setAutofillPlaylists,
  159. setBlacklist,
  160. updateCurrentSongRatings,
  161. updateOwnCurrentSongRatings,
  162. updateCurrentSongSkipVotes,
  163. updateAutoRequestLock,
  164. hasPermission,
  165. addDj,
  166. removeDj,
  167. updatePermissions
  168. } = stationStore;
  169. // TODO fix this if it still has some use
  170. // const stopVideo = payload =>
  171. // store.dispatch("modals/editSong/stopVideo", payload);
  172. const updateMediaSessionData = song => {
  173. if (song) {
  174. ms.setMediaSessionData(
  175. 0,
  176. !localPaused.value && !stationPaused.value, // This should be improved later
  177. song.title,
  178. song.artists ? song.artists.join(", ") : null,
  179. null,
  180. song.thumbnail ||
  181. `https://img.youtube.com/vi/${song.youtubeId}/mqdefault.jpg`
  182. );
  183. } else ms.removeMediaSessionData(0);
  184. };
  185. const autoRequestSong = () => {
  186. if (
  187. !autoRequestLock.value &&
  188. songsList.value.length < 50 &&
  189. currentUserQueueSongs.value < station.value.requests.limit * 0.5 &&
  190. autoRequest.value.length > 0
  191. ) {
  192. const selectedPlaylist =
  193. autoRequest.value[
  194. Math.floor(Math.random() * autoRequest.value.length)
  195. ];
  196. if (selectedPlaylist._id && selectedPlaylist.songs.length > 0) {
  197. const selectedSong =
  198. selectedPlaylist.songs[
  199. Math.floor(Math.random() * selectedPlaylist.songs.length)
  200. ];
  201. if (selectedSong.youtubeId) {
  202. updateAutoRequestLock(true);
  203. socket.dispatch(
  204. "stations.addToQueue",
  205. station.value._id,
  206. selectedSong.youtubeId,
  207. data => {
  208. updateAutoRequestLock(false);
  209. if (data.status !== "success") {
  210. setTimeout(
  211. () => {
  212. autoRequestSong();
  213. },
  214. data.message ===
  215. "That song is already in the queue."
  216. ? 5000
  217. : 1000
  218. );
  219. }
  220. }
  221. );
  222. }
  223. }
  224. }
  225. };
  226. const dateCurrently = () => new Date().getTime() + systemDifference.value;
  227. const getTimeElapsed = () => {
  228. if (currentSong.value) {
  229. let localTimePaused = timePaused.value;
  230. if (stationPaused.value)
  231. localTimePaused += dateCurrently() - pausedAt.value;
  232. return dateCurrently() - startedAt.value - localTimePaused;
  233. }
  234. return 0;
  235. };
  236. const getTimeRemaining = () => {
  237. if (currentSong.value) {
  238. return currentSong.value.duration * 1000 - getTimeElapsed();
  239. }
  240. return 0;
  241. };
  242. const skipSong = () => {
  243. if (nextCurrentSong.value && nextCurrentSong.value.currentSong) {
  244. const _songsList = songsList.value.concat([]);
  245. if (
  246. _songsList.length > 0 &&
  247. _songsList[0].youtubeId ===
  248. nextCurrentSong.value.currentSong.youtubeId
  249. ) {
  250. _songsList.splice(0, 1);
  251. updateSongsList(_songsList);
  252. }
  253. // TODO fix
  254. // eslint-disable-next-line
  255. setCurrentSong(nextCurrentSong.value);
  256. } else {
  257. // TODO fix
  258. // eslint-disable-next-line
  259. setCurrentSong({
  260. currentSong: null,
  261. startedAt: 0,
  262. paused: stationPaused.value,
  263. timePaused: 0,
  264. pausedAt: 0
  265. });
  266. }
  267. };
  268. const setNextCurrentSong = (_nextCurrentSong, skipSkipCheck = false) => {
  269. nextCurrentSong.value = _nextCurrentSong;
  270. // If skipSkipCheck is true, it won't try to skip the song
  271. if (getTimeRemaining() <= 0 && !skipSkipCheck) {
  272. skipSong();
  273. }
  274. };
  275. const resizeSeekerbar = () => {
  276. seekerbarPercentage.value =
  277. (getTimeElapsed() / 1000 / currentSong.value.duration) * 100;
  278. };
  279. const calculateTimeElapsed = () => {
  280. if (
  281. playerReady.value &&
  282. !noSong.value &&
  283. currentSong.value &&
  284. player.value.getPlayerState() === -1
  285. ) {
  286. if (!canAutoplay.value) {
  287. if (Date.now() - lastTimeRequestedIfCanAutoplay.value > 2000) {
  288. lastTimeRequestedIfCanAutoplay.value = Date.now();
  289. canAutoPlay.video().then(({ result }) => {
  290. if (result) {
  291. attemptsToPlayVideo.value = 0;
  292. canAutoplay.value = true;
  293. } else {
  294. canAutoplay.value = false;
  295. }
  296. });
  297. }
  298. } else {
  299. player.value.playVideo();
  300. attemptsToPlayVideo.value += 1;
  301. }
  302. }
  303. if (
  304. !stationPaused.value &&
  305. !localPaused.value &&
  306. playerReady.value &&
  307. !isApple.value
  308. ) {
  309. const timeElapsed = getTimeElapsed();
  310. const currentPlayerTime =
  311. Math.max(
  312. player.value.getCurrentTime() - currentSong.value.skipDuration,
  313. 0
  314. ) * 1000;
  315. const difference = timeElapsed - currentPlayerTime;
  316. let _playbackRate = 1;
  317. if (difference < -2000) {
  318. if (!seeking.value) {
  319. seeking.value = true;
  320. player.value.seekTo(
  321. getTimeElapsed() / 1000 + currentSong.value.skipDuration
  322. );
  323. }
  324. } else if (difference < -200) {
  325. _playbackRate = 0.8;
  326. } else if (difference < -50) {
  327. _playbackRate = 0.9;
  328. } else if (difference < -25) {
  329. _playbackRate = 0.95;
  330. } else if (difference > 2000) {
  331. if (!seeking.value) {
  332. seeking.value = true;
  333. player.value.seekTo(
  334. getTimeElapsed() / 1000 + currentSong.value.skipDuration
  335. );
  336. }
  337. } else if (difference > 200) {
  338. _playbackRate = 1.2;
  339. } else if (difference > 50) {
  340. _playbackRate = 1.1;
  341. } else if (difference > 25) {
  342. _playbackRate = 1.05;
  343. } else if (player.value.getPlaybackRate !== 1.0) {
  344. player.value.setPlaybackRate(1.0);
  345. }
  346. if (playbackRate.value !== _playbackRate) {
  347. player.value.setPlaybackRate(_playbackRate);
  348. playbackRate.value = _playbackRate;
  349. }
  350. }
  351. let localTimePaused = timePaused.value;
  352. if (stationPaused.value)
  353. localTimePaused += dateCurrently() - pausedAt.value;
  354. const duration =
  355. (dateCurrently() - startedAt.value - localTimePaused) / 1000;
  356. const songDuration = currentSong.value.duration;
  357. if (playerReady.value && songDuration <= duration)
  358. player.value.pauseVideo();
  359. if (duration <= songDuration)
  360. timeElapsed.value =
  361. typeof duration === "number" ? utils.formatTime(duration) : "0";
  362. };
  363. const playVideo = () => {
  364. if (playerReady.value) {
  365. videoLoading.value = true;
  366. player.value.loadVideoById(
  367. currentSong.value.youtubeId,
  368. getTimeElapsed() / 1000 + currentSong.value.skipDuration
  369. );
  370. if (window.stationInterval !== 0) clearInterval(window.stationInterval);
  371. window.stationInterval = window.setInterval(() => {
  372. if (!stationPaused.value) {
  373. resizeSeekerbar();
  374. calculateTimeElapsed();
  375. }
  376. }, 150);
  377. }
  378. };
  379. const toggleSkipVote = (message?) => {
  380. socket.dispatch("stations.toggleSkipVote", station.value._id, data => {
  381. if (data.status !== "success") new Toast(`Error: ${data.message}`);
  382. else
  383. new Toast(
  384. message || "Successfully toggled vote to skip the current song."
  385. );
  386. });
  387. };
  388. const youtubeReady = () => {
  389. if (!player.value) {
  390. ms.setYTReady(false);
  391. player.value = new window.YT.Player("stationPlayer", {
  392. height: 270,
  393. width: 480,
  394. videoId: currentSong.value.youtubeId,
  395. host: "https://www.youtube-nocookie.com",
  396. startSeconds:
  397. getTimeElapsed() / 1000 + currentSong.value.skipDuration,
  398. playerVars: {
  399. controls: 0,
  400. iv_load_policy: 3,
  401. rel: 0,
  402. showinfo: 0,
  403. disablekb: 1,
  404. playsinline: 1
  405. },
  406. events: {
  407. onReady: () => {
  408. playerReady.value = true;
  409. ms.setYTReady(true);
  410. let volume = parseFloat(localStorage.getItem("volume"));
  411. volume = typeof volume === "number" ? volume : 20;
  412. player.value.setVolume(volume);
  413. if (volume > 0) player.value.unMute();
  414. if (muted.value) player.value.mute();
  415. playVideo();
  416. const duration =
  417. (dateCurrently() - startedAt.value - timePaused.value) /
  418. 1000;
  419. const songDuration = currentSong.value.duration;
  420. if (songDuration <= duration) player.value.pauseVideo();
  421. // on ios, playback will be forcibly paused locally
  422. if (isApple.value) {
  423. updateLocalPaused(true);
  424. new Toast(
  425. `Please click play manually to use ${sitename.value} on iOS.`
  426. );
  427. }
  428. },
  429. onError: err => {
  430. console.log("error with youtube video", err);
  431. if (err.data === 150 && loggedIn.value) {
  432. if (
  433. !(localPaused.value || stationPaused.value) &&
  434. !currentSong.value.voted
  435. ) {
  436. // automatically vote to skip
  437. toggleSkipVote(
  438. "Automatically voted to skip as this song isn't available for you."
  439. );
  440. }
  441. // persistent message while song is playing
  442. const persistentToast = new Toast({
  443. content:
  444. "This song is unavailable for you, but is playing for everyone else.",
  445. persistent: true
  446. });
  447. // save current song id
  448. const erroredYoutubeId = currentSong.value.youtubeId;
  449. persistentToasts.value.push({
  450. toast: persistentToast,
  451. checkIfCanRemove: () => {
  452. if (
  453. currentSong.value.youtubeId !==
  454. erroredYoutubeId
  455. ) {
  456. persistentToast.destroy();
  457. return true;
  458. }
  459. return false;
  460. }
  461. });
  462. } else {
  463. new Toast(
  464. "There has been an error with the YouTube Embed"
  465. );
  466. }
  467. },
  468. onStateChange: event => {
  469. if (
  470. event.data === window.YT.PlayerState.PLAYING &&
  471. videoLoading.value === true
  472. ) {
  473. videoLoading.value = false;
  474. player.value.seekTo(
  475. getTimeElapsed() / 1000 +
  476. currentSong.value.skipDuration,
  477. true
  478. );
  479. canAutoplay.value = true;
  480. if (localPaused.value || stationPaused.value)
  481. player.value.pauseVideo();
  482. } else if (
  483. event.data === window.YT.PlayerState.PLAYING &&
  484. (localPaused.value || stationPaused.value)
  485. ) {
  486. player.value.seekTo(timeBeforePause.value / 1000, true);
  487. player.value.pauseVideo();
  488. } else if (
  489. event.data === window.YT.PlayerState.PLAYING &&
  490. seeking.value === true
  491. )
  492. seeking.value = false;
  493. if (
  494. event.data === window.YT.PlayerState.PAUSED &&
  495. !localPaused.value &&
  496. !stationPaused.value &&
  497. !noSong.value &&
  498. player.value.getDuration() / 1000 <
  499. currentSong.value.duration
  500. ) {
  501. player.value.seekTo(
  502. getTimeElapsed() / 1000 +
  503. currentSong.value.skipDuration,
  504. true
  505. );
  506. player.value.playVideo();
  507. }
  508. }
  509. }
  510. });
  511. }
  512. };
  513. const setCurrentSong = data => {
  514. const {
  515. currentSong: _currentSong,
  516. startedAt: _startedAt,
  517. paused: _paused,
  518. timePaused: _timePaused,
  519. pausedAt: _pausedAt
  520. } = data;
  521. if (_currentSong) {
  522. if (!_currentSong.skipDuration || _currentSong.skipDuration < 0)
  523. _currentSong.skipDuration = 0;
  524. if (!_currentSong.duration || _currentSong.duration < 0)
  525. _currentSong.duration = 0;
  526. }
  527. updateCurrentSong(_currentSong || {});
  528. let nextSong = null;
  529. if (songsList.value[0])
  530. nextSong = songsList.value[0].youtubeId ? songsList.value[0] : null;
  531. updateNextSong(nextSong);
  532. setNextCurrentSong(
  533. {
  534. currentSong: null,
  535. startedAt: 0,
  536. _paused,
  537. timePaused: 0,
  538. pausedAt: 0
  539. },
  540. true
  541. );
  542. clearTimeout(window.stationNextSongTimeout);
  543. if (mediasession.value) updateMediaSessionData(_currentSong);
  544. startedAt.value = _startedAt;
  545. updateStationPaused(_paused);
  546. timePaused.value = _timePaused;
  547. pausedAt.value = _pausedAt;
  548. if (_currentSong) {
  549. updateNoSong(false);
  550. if (!playerReady.value) youtubeReady();
  551. else playVideo();
  552. // If the station is playing and the backend is not connected, set the next song to skip to after this song and set a timer to skip
  553. if (!stationPaused.value && !socket.ready) {
  554. if (nextSong)
  555. setNextCurrentSong(
  556. {
  557. currentSong: nextSong,
  558. startedAt: Date.now() + getTimeRemaining(),
  559. paused: false,
  560. timePaused: 0
  561. },
  562. true
  563. );
  564. else
  565. setNextCurrentSong(
  566. {
  567. currentSong: null,
  568. startedAt: 0,
  569. paused: false,
  570. timePaused: 0,
  571. pausedAt: 0
  572. },
  573. true
  574. );
  575. window.stationNextSongTimeout = setTimeout(() => {
  576. if (
  577. !noSong.value &&
  578. _currentSong.value._id === _currentSong._id
  579. )
  580. skipSong();
  581. }, getTimeRemaining());
  582. }
  583. const currentSongId = currentSong.value._id;
  584. socket.dispatch(
  585. "stations.getSkipVotes",
  586. station.value._id,
  587. currentSongId,
  588. res => {
  589. if (res.status === "success") {
  590. const { skipVotes, skipVotesCurrent, voted } = res.data;
  591. if (
  592. !noSong.value &&
  593. currentSong.value._id === currentSongId
  594. ) {
  595. updateCurrentSongSkipVotes({
  596. skipVotes,
  597. skipVotesCurrent,
  598. voted
  599. });
  600. }
  601. }
  602. }
  603. );
  604. socket.dispatch("media.getRatings", _currentSong.youtubeId, res => {
  605. if (_currentSong.youtubeId === currentSong.value.youtubeId) {
  606. const { likes, dislikes } = res.data;
  607. updateCurrentSongRatings({ likes, dislikes });
  608. }
  609. });
  610. if (loggedIn.value) {
  611. socket.dispatch(
  612. "media.getOwnRatings",
  613. _currentSong.youtubeId,
  614. res => {
  615. console.log("getOwnSongRatings", res);
  616. if (
  617. res.status === "success" &&
  618. currentSong.value.youtubeId === res.data.youtubeId
  619. ) {
  620. updateOwnCurrentSongRatings(res.data);
  621. if (
  622. autoSkipDisliked.value &&
  623. res.data.disliked === true &&
  624. !(localPaused.value || stationPaused.value) &&
  625. !currentSong.value.voted
  626. ) {
  627. toggleSkipVote(
  628. "Automatically voted to skip disliked song."
  629. );
  630. }
  631. }
  632. }
  633. );
  634. }
  635. } else {
  636. if (playerReady.value) player.value.stopVideo();
  637. updateNoSong(true);
  638. }
  639. calculateTimeElapsed();
  640. resizeSeekerbar();
  641. };
  642. const changeVolume = () => {
  643. const volume = volumeSliderValue.value;
  644. localStorage.setItem("volume", `${volume}`);
  645. if (playerReady.value) {
  646. player.value.setVolume(volume);
  647. if (volume > 0) {
  648. player.value.unMute();
  649. localStorage.setItem("muted", "false");
  650. muted.value = false;
  651. }
  652. }
  653. };
  654. const resumeLocalPlayer = () => {
  655. if (mediasession.value) updateMediaSessionData(currentSong.value);
  656. if (!noSong.value) {
  657. if (playerReady.value) {
  658. player.value.seekTo(
  659. getTimeElapsed() / 1000 + currentSong.value.skipDuration
  660. );
  661. player.value.playVideo();
  662. }
  663. }
  664. };
  665. const pauseLocalPlayer = () => {
  666. if (mediasession.value) updateMediaSessionData(currentSong.value);
  667. if (!noSong.value) {
  668. timeBeforePause.value = getTimeElapsed();
  669. if (playerReady.value) player.value.pauseVideo();
  670. }
  671. };
  672. const resumeLocalStation = () => {
  673. updateLocalPaused(false);
  674. if (!stationPaused.value) resumeLocalPlayer();
  675. };
  676. const pauseLocalStation = () => {
  677. updateLocalPaused(true);
  678. pauseLocalPlayer();
  679. };
  680. const skipStation = () => {
  681. socket.dispatch("stations.forceSkip", station.value._id, data => {
  682. if (data.status !== "success") new Toast(`Error: ${data.message}`);
  683. else new Toast("Successfully skipped the station's current song.");
  684. });
  685. };
  686. const resumeStation = () => {
  687. socket.dispatch("stations.resume", station.value._id, data => {
  688. if (data.status !== "success") new Toast(`Error: ${data.message}`);
  689. else new Toast("Successfully resumed the station.");
  690. });
  691. };
  692. const pauseStation = () => {
  693. socket.dispatch("stations.pause", station.value._id, data => {
  694. if (data.status !== "success") new Toast(`Error: ${data.message}`);
  695. else new Toast("Successfully paused the station.");
  696. });
  697. };
  698. const toggleMute = () => {
  699. if (playerReady.value) {
  700. const previousVolume = parseFloat(localStorage.getItem("volume"));
  701. const volume = player.value.getVolume() <= 0 ? previousVolume : 0;
  702. muted.value = !muted.value;
  703. localStorage.setItem("muted", `${muted.value}`);
  704. volumeSliderValue.value = volume;
  705. player.value.setVolume(volume);
  706. if (!muted.value) localStorage.setItem("volume", `${volume}`);
  707. }
  708. };
  709. const increaseVolume = () => {
  710. if (playerReady.value) {
  711. const previousVolume = parseFloat(localStorage.getItem("volume"));
  712. let volume = previousVolume + 5;
  713. if (previousVolume === 0) {
  714. muted.value = false;
  715. localStorage.setItem("muted", "false");
  716. }
  717. if (volume > 100) volume = 100;
  718. volumeSliderValue.value = volume;
  719. player.value.setVolume(volume);
  720. localStorage.setItem("volume", `${volume}`);
  721. }
  722. };
  723. const toggleLike = () => {
  724. if (currentSong.value.liked)
  725. socket.dispatch("media.unlike", currentSong.value.youtubeId, res => {
  726. if (res.status !== "success") new Toast(`Error: ${res.message}`);
  727. });
  728. else
  729. socket.dispatch("media.like", currentSong.value.youtubeId, res => {
  730. if (res.status !== "success") new Toast(`Error: ${res.message}`);
  731. });
  732. };
  733. const toggleDislike = () => {
  734. if (currentSong.value.disliked)
  735. return socket.dispatch(
  736. "media.undislike",
  737. currentSong.value.youtubeId,
  738. res => {
  739. if (res.status !== "success")
  740. new Toast(`Error: ${res.message}`);
  741. }
  742. );
  743. return socket.dispatch(
  744. "media.dislike",
  745. currentSong.value.youtubeId,
  746. res => {
  747. if (res.status !== "success") new Toast(`Error: ${res.message}`);
  748. }
  749. );
  750. };
  751. const togglePlayerDebugBox = () => {
  752. playerDebugBox.value.toggleBox();
  753. };
  754. const resetPlayerDebugBox = () => {
  755. playerDebugBox.value.resetBox();
  756. };
  757. const toggleKeyboardShortcutsHelper = () => {
  758. keyboardShortcutsHelper.value.toggleBox();
  759. };
  760. const resetKeyboardShortcutsHelper = () => {
  761. keyboardShortcutsHelper.value.resetBox();
  762. };
  763. const sendActivityWatchVideoData = () => {
  764. if (
  765. !stationPaused.value &&
  766. !localPaused.value &&
  767. !noSong.value &&
  768. player.value.getPlayerState() === window.YT.PlayerState.PLAYING
  769. ) {
  770. if (activityWatchVideoLastStatus.value !== "playing") {
  771. activityWatchVideoLastStatus.value = "playing";
  772. activityWatchVideoLastStartDuration.value =
  773. currentSong.value.skipDuration + getTimeElapsed();
  774. }
  775. if (
  776. activityWatchVideoLastYouTubeId.value !==
  777. currentSong.value.youtubeId
  778. ) {
  779. activityWatchVideoLastYouTubeId.value = currentSong.value.youtubeId;
  780. activityWatchVideoLastStartDuration.value =
  781. currentSong.value.skipDuration + getTimeElapsed();
  782. }
  783. const videoData = {
  784. title: currentSong.value ? currentSong.value.title : null,
  785. artists:
  786. currentSong.value && currentSong.value.artists
  787. ? currentSong.value.artists.join(", ")
  788. : null,
  789. youtubeId: currentSong.value.youtubeId,
  790. muted: muted.value,
  791. volume: volumeSliderValue.value,
  792. startedDuration:
  793. activityWatchVideoLastStartDuration.value <= 0
  794. ? 0
  795. : Math.floor(
  796. activityWatchVideoLastStartDuration.value / 1000
  797. ),
  798. source: `station#${station.value.name}`,
  799. hostname: window.location.hostname,
  800. playerState: Object.keys(window.YT.PlayerState).find(
  801. key =>
  802. window.YT.PlayerState[key] === player.value.getPlayerState()
  803. ),
  804. playbackRate: playbackRate.value
  805. };
  806. aw.sendVideoData(videoData);
  807. } else {
  808. activityWatchVideoLastStatus.value = "not_playing";
  809. }
  810. };
  811. const experimentalChangableListenModeChange = newMode => {
  812. if (newMode === "participate") {
  813. // Destroy the YouTube player
  814. if (player.value) {
  815. player.value.destroy();
  816. player.value = null;
  817. }
  818. } else {
  819. // Recreate the YouTube player
  820. youtubeReady();
  821. }
  822. experimentalChangableListenMode.value = newMode;
  823. localStorage.setItem(
  824. `experimental_changeable_listen_mode_${station.value._id}`,
  825. newMode
  826. );
  827. };
  828. watch(
  829. () => autoRequest.value.length,
  830. () => {
  831. autoRequestSong();
  832. }
  833. );
  834. onMounted(async () => {
  835. mediaModalWatcher.value = stationStore.$onAction(({ name, args }) => {
  836. if (name === "updateMediaModalPlayingAudio") {
  837. const [mediaModalPlayingAudio] = args;
  838. if (mediaModalPlayingAudio) {
  839. if (!beforeMediaModalLocalPausedLock.value) {
  840. beforeMediaModalLocalPausedLock.value = true;
  841. beforeMediaModalLocalPaused.value = localPaused.value;
  842. pauseLocalStation();
  843. }
  844. } else {
  845. beforeMediaModalLocalPausedLock.value = false;
  846. if (!beforeMediaModalLocalPaused.value) resumeLocalStation();
  847. }
  848. }
  849. });
  850. document.body.scrollTo(0, 0);
  851. stationIdentifier.value = route.params.id;
  852. window.stationInterval = 0;
  853. activityWatchVideoDataInterval.value = setInterval(() => {
  854. sendActivityWatchVideoData();
  855. }, 1000);
  856. persistentToastCheckerInterval.value = setInterval(() => {
  857. persistentToasts.value.filter(
  858. persistentToast => !persistentToast.checkIfCanRemove()
  859. );
  860. }, 1000);
  861. const experimental = await lofig.get("experimental");
  862. socket.onConnect(() => {
  863. clearTimeout(window.stationNextSongTimeout);
  864. socket.dispatch("stations.join", stationIdentifier.value, async res => {
  865. if (res.status === "success") {
  866. setTimeout(() => {
  867. loading.value = false;
  868. }, 1000); // prevents popping in of youtube embed etc.
  869. const {
  870. _id,
  871. displayName,
  872. name,
  873. description,
  874. privacy,
  875. owner,
  876. autofill,
  877. blacklist,
  878. type,
  879. isFavorited,
  880. theme,
  881. requests,
  882. djs
  883. } = res.data;
  884. if (experimental && experimental.changable_listen_mode) {
  885. if (experimental.changable_listen_mode === true)
  886. experimentalChangableListenModeEnabled.value = true;
  887. else if (
  888. Array.isArray(experimental.changable_listen_mode) &&
  889. experimental.changable_listen_mode.indexOf(_id) !== -1
  890. )
  891. experimentalChangableListenModeEnabled.value = true;
  892. }
  893. if (experimentalChangableListenModeEnabled.value) {
  894. console.log(
  895. `Experimental changeable listen mode is enabled`
  896. );
  897. const experimentalChangeableListenModeLS =
  898. localStorage.getItem(
  899. `experimental_changeable_listen_mode_${_id}`
  900. );
  901. if (experimentalChangeableListenModeLS)
  902. experimentalChangableListenMode.value =
  903. experimentalChangeableListenModeLS;
  904. }
  905. // change url to use station name instead of station id
  906. if (name !== stationIdentifier.value) {
  907. // eslint-disable-next-line no-restricted-globals
  908. router.replace(name);
  909. }
  910. joinStation({
  911. _id,
  912. name,
  913. displayName,
  914. description,
  915. privacy,
  916. owner,
  917. autofill,
  918. blacklist,
  919. type,
  920. isFavorited,
  921. theme,
  922. requests,
  923. djs
  924. });
  925. document.getElementsByTagName(
  926. "html"
  927. )[0].style.cssText = `--primary-color: var(--${res.data.theme})`;
  928. setCurrentSong({
  929. currentSong: res.data.currentSong,
  930. startedAt: res.data.startedAt,
  931. paused: res.data.paused,
  932. timePaused: res.data.timePaused,
  933. pausedAt: res.data.pausedAt
  934. });
  935. updateUserCount(res.data.userCount);
  936. updateUsers(res.data.users);
  937. await updatePermissions();
  938. socket.dispatch(
  939. "stations.getStationAutofillPlaylistsById",
  940. station.value._id,
  941. res => {
  942. if (res.status === "success") {
  943. setAutofillPlaylists(res.data.playlists);
  944. }
  945. }
  946. );
  947. socket.dispatch(
  948. "stations.getStationBlacklistById",
  949. station.value._id,
  950. res => {
  951. if (res.status === "success") {
  952. setBlacklist(res.data.playlists);
  953. }
  954. }
  955. );
  956. socket.dispatch("stations.getQueue", _id, res => {
  957. if (res.status === "success") {
  958. const { queue } = res.data;
  959. updateSongsList(queue);
  960. const [nextSong] = queue;
  961. updateNextSong(nextSong);
  962. }
  963. });
  964. if (hasPermission("stations.playback.toggle"))
  965. keyboardShortcuts.registerShortcut("station.pauseResume", {
  966. keyCode: 32, // Spacebar
  967. shift: false,
  968. ctrl: true,
  969. preventDefault: true,
  970. handler: () => {
  971. if (aModalIsOpen.value) return;
  972. if (stationPaused.value) resumeStation();
  973. else pauseStation();
  974. }
  975. });
  976. if (hasPermission("stations.skip"))
  977. keyboardShortcuts.registerShortcut("station.skipStation", {
  978. keyCode: 39, // Right arrow key
  979. shift: false,
  980. ctrl: true,
  981. preventDefault: true,
  982. handler: () => {
  983. if (aModalIsOpen.value) return;
  984. skipStation();
  985. }
  986. });
  987. keyboardShortcuts.registerShortcut("station.lowerVolumeLarge", {
  988. keyCode: 40, // Down arrow key
  989. shift: false,
  990. ctrl: true,
  991. preventDefault: true,
  992. handler: () => {
  993. if (aModalIsOpen.value) return;
  994. volumeSliderValue.value -= 10;
  995. changeVolume();
  996. }
  997. });
  998. keyboardShortcuts.registerShortcut("station.lowerVolumeSmall", {
  999. keyCode: 40, // Down arrow key
  1000. shift: true,
  1001. ctrl: true,
  1002. preventDefault: true,
  1003. handler: () => {
  1004. if (aModalIsOpen.value) return;
  1005. volumeSliderValue.value -= 1;
  1006. changeVolume();
  1007. }
  1008. });
  1009. keyboardShortcuts.registerShortcut(
  1010. "station.increaseVolumeLarge",
  1011. {
  1012. keyCode: 38, // Up arrow key
  1013. shift: false,
  1014. ctrl: true,
  1015. preventDefault: true,
  1016. handler: () => {
  1017. if (aModalIsOpen.value) return;
  1018. volumeSliderValue.value += 10;
  1019. changeVolume();
  1020. }
  1021. }
  1022. );
  1023. keyboardShortcuts.registerShortcut(
  1024. "station.increaseVolumeSmall",
  1025. {
  1026. keyCode: 38, // Up arrow key
  1027. shift: true,
  1028. ctrl: true,
  1029. preventDefault: true,
  1030. handler: () => {
  1031. if (aModalIsOpen.value) return;
  1032. volumeSliderValue.value += 1;
  1033. changeVolume();
  1034. }
  1035. }
  1036. );
  1037. keyboardShortcuts.registerShortcut("station.toggleDebug", {
  1038. keyCode: 68, // D key
  1039. shift: false,
  1040. ctrl: true,
  1041. preventDefault: true,
  1042. handler: () => {
  1043. if (aModalIsOpen.value) return;
  1044. togglePlayerDebugBox();
  1045. }
  1046. });
  1047. keyboardShortcuts.registerShortcut(
  1048. "station.toggleKeyboardShortcutsHelper",
  1049. {
  1050. keyCode: 191, // '/' key
  1051. ctrl: true,
  1052. preventDefault: true,
  1053. handler: () => {
  1054. if (aModalIsOpen.value) return;
  1055. toggleKeyboardShortcutsHelper();
  1056. }
  1057. }
  1058. );
  1059. keyboardShortcuts.registerShortcut(
  1060. "station.resetKeyboardShortcutsHelper",
  1061. {
  1062. keyCode: 191, // '/' key
  1063. ctrl: true,
  1064. shift: true,
  1065. preventDefault: true,
  1066. handler: () => {
  1067. if (aModalIsOpen.value) return;
  1068. resetKeyboardShortcutsHelper();
  1069. }
  1070. }
  1071. );
  1072. // UNIX client time before ping
  1073. const beforePing = Date.now();
  1074. socket.dispatch("apis.ping", res => {
  1075. if (res.status === "success") {
  1076. // UNIX client time after ping
  1077. const afterPing = Date.now();
  1078. // Average time in MS it took between the server responding and the client receiving
  1079. const connectionLatency = (afterPing - beforePing) / 2;
  1080. console.log(connectionLatency, beforePing - afterPing);
  1081. // UNIX server time
  1082. const serverDate = res.data.date;
  1083. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1084. const difference =
  1085. serverDate + connectionLatency - afterPing;
  1086. console.log("Difference: ", difference);
  1087. if (difference > 3000 || difference < -3000) {
  1088. console.log(
  1089. "System time difference is bigger than 3 seconds."
  1090. );
  1091. }
  1092. systemDifference.value = difference;
  1093. }
  1094. });
  1095. } else {
  1096. loading.value = false;
  1097. exists.value = false;
  1098. }
  1099. });
  1100. socket.dispatch(
  1101. "stations.existsByName",
  1102. stationIdentifier.value,
  1103. res => {
  1104. if (res.status === "error" || !res.data.exists) {
  1105. // station identifier may be using stationid instead
  1106. socket.dispatch(
  1107. "stations.existsById",
  1108. stationIdentifier.value,
  1109. res => {
  1110. if (res.status === "error" || !res.data.exists) {
  1111. loading.value = false;
  1112. exists.value = false;
  1113. }
  1114. }
  1115. );
  1116. }
  1117. }
  1118. );
  1119. });
  1120. socket.onDisconnect(() => {
  1121. const _currentSong = currentSong.value;
  1122. if (nextSong.value)
  1123. setNextCurrentSong(
  1124. {
  1125. currentSong: nextSong.value,
  1126. startedAt: Date.now() + getTimeRemaining(),
  1127. paused: false,
  1128. timePaused: 0
  1129. },
  1130. true
  1131. );
  1132. else
  1133. setNextCurrentSong(
  1134. {
  1135. currentSong: null,
  1136. startedAt: 0,
  1137. paused: false,
  1138. timePaused: 0,
  1139. pausedAt: 0
  1140. },
  1141. true
  1142. );
  1143. window.stationNextSongTimeout = setTimeout(() => {
  1144. if (!noSong.value && currentSong.value._id === _currentSong._id)
  1145. skipSong();
  1146. }, getTimeRemaining());
  1147. }, true);
  1148. socket.on("event:station.nextSong", res => {
  1149. const { currentSong, startedAt, paused, timePaused } = res.data;
  1150. setCurrentSong({
  1151. currentSong,
  1152. startedAt,
  1153. paused,
  1154. timePaused,
  1155. pausedAt: 0
  1156. });
  1157. });
  1158. socket.on("event:station.pause", res => {
  1159. pausedAt.value = res.data.pausedAt;
  1160. updateStationPaused(true);
  1161. pauseLocalPlayer();
  1162. clearTimeout(window.stationNextSongTimeout);
  1163. });
  1164. socket.on("event:station.resume", res => {
  1165. timePaused.value = res.data.timePaused;
  1166. updateStationPaused(false);
  1167. if (!localPaused.value) resumeLocalPlayer();
  1168. autoRequestSong();
  1169. });
  1170. socket.on("event:station.deleted", () => {
  1171. router.push({
  1172. path: "/",
  1173. query: {
  1174. toast: "The station you were in was deleted."
  1175. }
  1176. });
  1177. });
  1178. socket.on("event:ratings.liked", res => {
  1179. if (!noSong.value) {
  1180. if (res.data.youtubeId === currentSong.value.youtubeId) {
  1181. updateCurrentSongRatings(res.data);
  1182. }
  1183. }
  1184. });
  1185. socket.on("event:ratings.disliked", res => {
  1186. if (!noSong.value) {
  1187. if (res.data.youtubeId === currentSong.value.youtubeId) {
  1188. updateCurrentSongRatings(res.data);
  1189. }
  1190. }
  1191. });
  1192. socket.on("event:ratings.unliked", res => {
  1193. if (!noSong.value) {
  1194. if (res.data.youtubeId === currentSong.value.youtubeId) {
  1195. updateCurrentSongRatings(res.data);
  1196. }
  1197. }
  1198. });
  1199. socket.on("event:ratings.undisliked", res => {
  1200. if (!noSong.value) {
  1201. if (res.data.youtubeId === currentSong.value.youtubeId) {
  1202. updateCurrentSongRatings(res.data);
  1203. }
  1204. }
  1205. });
  1206. socket.on("event:ratings.updated", res => {
  1207. if (!noSong.value) {
  1208. if (res.data.youtubeId === currentSong.value.youtubeId) {
  1209. updateOwnCurrentSongRatings(res.data);
  1210. }
  1211. }
  1212. });
  1213. socket.on("event:station.queue.updated", res => {
  1214. updateSongsList(res.data.queue);
  1215. let nextSong = null;
  1216. if (songsList.value[0])
  1217. nextSong = songsList.value[0].youtubeId ? songsList.value[0] : null;
  1218. updateNextSong(nextSong);
  1219. autoRequestSong();
  1220. });
  1221. socket.on("event:station.queue.song.repositioned", res => {
  1222. repositionSongInList(res.data.song);
  1223. let nextSong = null;
  1224. if (songsList.value[0])
  1225. nextSong = songsList.value[0].youtubeId ? songsList.value[0] : null;
  1226. updateNextSong(nextSong);
  1227. });
  1228. socket.on("event:station.toggleSkipVote", res => {
  1229. if (currentSong.value)
  1230. updateCurrentSongSkipVotes({
  1231. skipVotes: res.data.voted
  1232. ? currentSong.value.skipVotes + 1
  1233. : currentSong.value.skipVotes - 1,
  1234. skipVotesCurrent: null,
  1235. voted:
  1236. res.data.userId === userId.value
  1237. ? res.data.voted
  1238. : currentSong.value.voted
  1239. });
  1240. });
  1241. socket.on("event:station.updated", async res => {
  1242. const { name, theme, privacy } = res.data.station;
  1243. if (!hasPermission("stations.view") && privacy === "private") {
  1244. router.push({
  1245. path: "/",
  1246. query: {
  1247. toast: "The station you were in was made private."
  1248. }
  1249. });
  1250. } else {
  1251. if (station.value.name !== name) {
  1252. await router.push(
  1253. `${name}?${Object.keys(route.query)
  1254. .map(
  1255. key =>
  1256. `${encodeURIComponent(
  1257. key
  1258. )}=${encodeURIComponent(
  1259. JSON.stringify(route.query[key])
  1260. )}`
  1261. )
  1262. .join("&")}`
  1263. );
  1264. // eslint-disable-next-line no-restricted-globals
  1265. history.replaceState({ ...history.state, ...{} }, null);
  1266. }
  1267. if (station.value.theme !== theme)
  1268. document.getElementsByTagName(
  1269. "html"
  1270. )[0].style.cssText = `--primary-color: var(--${theme})`;
  1271. updateStation(res.data.station);
  1272. }
  1273. });
  1274. socket.on("event:station.users.updated", res =>
  1275. updateUsers(res.data.users)
  1276. );
  1277. socket.on("event:station.userCount.updated", res =>
  1278. updateUserCount(res.data.userCount)
  1279. );
  1280. socket.on("event:user.station.favorited", res => {
  1281. if (res.data.stationId === station.value._id)
  1282. updateIfStationIsFavorited({ isFavorited: true });
  1283. });
  1284. socket.on("event:user.station.unfavorited", res => {
  1285. if (res.data.stationId === station.value._id)
  1286. updateIfStationIsFavorited({ isFavorited: false });
  1287. });
  1288. socket.on("event:station.djs.added", res => {
  1289. if (res.data.user._id === userId.value)
  1290. updatePermissions().then(() => {
  1291. if (
  1292. !hasPermission("stations.view") &&
  1293. station.value.privacy === "private"
  1294. )
  1295. router.push({
  1296. path: "/",
  1297. query: {
  1298. toast: "You no longer have access to the station you were in."
  1299. }
  1300. });
  1301. });
  1302. addDj(res.data.user);
  1303. });
  1304. socket.on("event:station.djs.removed", res => {
  1305. if (res.data.user._id === userId.value)
  1306. updatePermissions().then(() => {
  1307. if (
  1308. !hasPermission("stations.view") &&
  1309. station.value.privacy === "private"
  1310. )
  1311. router.push({
  1312. path: "/",
  1313. query: {
  1314. toast: "You no longer have access to the station you were in."
  1315. }
  1316. });
  1317. });
  1318. removeDj(res.data.user);
  1319. });
  1320. socket.on("keep.event:user.role.updated", () => {
  1321. updatePermissions().then(() => {
  1322. if (
  1323. !hasPermission("stations.view") &&
  1324. station.value.privacy === "private"
  1325. )
  1326. router.push({
  1327. path: "/",
  1328. query: {
  1329. toast: "You no longer have access to the station you were in."
  1330. }
  1331. });
  1332. });
  1333. });
  1334. frontendDevMode.value = await lofig.get("mode");
  1335. mediasession.value = await lofig.get("siteSettings.mediasession");
  1336. christmas.value = await lofig.get("siteSettings.christmas");
  1337. sitename.value = await lofig.get("siteSettings.sitename");
  1338. ms.setListeners(0, {
  1339. play: () => {
  1340. if (hasPermission("stations.playback.toggle")) resumeStation();
  1341. else resumeLocalStation();
  1342. },
  1343. pause: () => {
  1344. if (hasPermission("stations.playback.toggle")) pauseStation();
  1345. else pauseLocalStation();
  1346. },
  1347. nexttrack: () => {
  1348. if (hasPermission("stations.skip")) skipStation();
  1349. else if (!currentSong.value.voted) toggleSkipVote();
  1350. }
  1351. });
  1352. if (JSON.parse(localStorage.getItem("muted"))) {
  1353. muted.value = true;
  1354. player.value.setVolume(0);
  1355. volumeSliderValue.value = 0;
  1356. } else {
  1357. let volume = parseFloat(localStorage.getItem("volume"));
  1358. volume =
  1359. typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
  1360. localStorage.setItem("volume", `${volume}`);
  1361. volumeSliderValue.value = volume;
  1362. }
  1363. });
  1364. onBeforeUnmount(() => {
  1365. document.getElementsByTagName("html")[0].style.cssText = "";
  1366. if (mediasession.value) {
  1367. ms.removeListeners(0);
  1368. ms.removeMediaSessionData(0);
  1369. }
  1370. /** Reset Songslist */
  1371. updateSongsList([]);
  1372. const shortcutNames = [
  1373. "station.pauseResume",
  1374. "station.skipStation",
  1375. "station.lowerVolumeLarge",
  1376. "station.lowerVolumeSmall",
  1377. "station.increaseVolumeLarge",
  1378. "station.increaseVolumeSmall",
  1379. "station.toggleDebug"
  1380. ];
  1381. shortcutNames.forEach(shortcutName => {
  1382. keyboardShortcuts.unregisterShortcut(shortcutName);
  1383. });
  1384. mediaModalWatcher.value(); // removes the watcher
  1385. clearInterval(activityWatchVideoDataInterval.value);
  1386. clearTimeout(window.stationNextSongTimeout);
  1387. clearTimeout(persistentToastCheckerInterval.value);
  1388. persistentToasts.value.forEach(persistentToast => {
  1389. persistentToast.toast.destroy();
  1390. });
  1391. socket.dispatch("stations.leave", station.value._id, () => {});
  1392. leaveStation();
  1393. // Delete the Pinia store that was created for this station, after all other cleanup tasks are performed
  1394. stationStore.$dispose();
  1395. });
  1396. </script>
  1397. <template>
  1398. <div>
  1399. <page-metadata
  1400. v-if="exists && !loading"
  1401. :title="`${station.displayName}`"
  1402. />
  1403. <page-metadata v-else-if="!exists && !loading" :title="`Not found`" />
  1404. <div id="page-loader-container" v-if="loading">
  1405. <content-loader
  1406. width="1920"
  1407. height="1080"
  1408. :primary-color="nightmode ? '#222' : '#fff'"
  1409. :secondary-color="nightmode ? '#444' : '#ddd'"
  1410. preserve-aspect-ratio="none"
  1411. id="page-loader-content"
  1412. >
  1413. <rect x="55" y="105" rx="5" ry="5" width="670" height="149" />
  1414. <rect x="55" y="283" rx="5" ry="5" width="670" height="640" />
  1415. <rect x="745" y="108" rx="5" ry="5" width="1120" height="672" />
  1416. <rect x="745" y="810" rx="5" ry="5" width="1120" height="110" />
  1417. </content-loader>
  1418. <content-loader
  1419. width="1920"
  1420. height="1080"
  1421. :primary-color="nightmode ? '#222' : '#fff'"
  1422. :secondary-color="nightmode ? '#444' : '#ddd'"
  1423. preserve-aspect-ratio="none"
  1424. id="page-loader-layout"
  1425. >
  1426. <rect x="0" y="0" rx="0" ry="0" width="1920" height="64" />
  1427. <rect x="0" y="980" rx="0" ry="0" width="1920" height="100" />
  1428. </content-loader>
  1429. </div>
  1430. <!-- More simplistic loading animation for mobile users -->
  1431. <div v-show="loading" id="mobile-progress-animation" />
  1432. <ul
  1433. v-if="
  1434. currentSong &&
  1435. (currentSong.youtubeId === 'l9PxOanFjxQ' ||
  1436. currentSong.youtubeId === 'xKVcVSYmesU' ||
  1437. currentSong.youtubeId === '60ItHLz5WEA' ||
  1438. currentSong.youtubeId === 'e6vkFbtSGm0')
  1439. "
  1440. class="bg-bubbles"
  1441. >
  1442. <li></li>
  1443. <li></li>
  1444. <li></li>
  1445. <li></li>
  1446. <li></li>
  1447. <li></li>
  1448. <li></li>
  1449. <li></li>
  1450. <li></li>
  1451. <li></li>
  1452. </ul>
  1453. <div v-show="!loading && exists">
  1454. <main-header />
  1455. <div id="station-outer-container">
  1456. <div
  1457. id="station-inner-container"
  1458. :class="{ 'nothing-here': noSong }"
  1459. >
  1460. <div id="station-left-column" class="column">
  1461. <!-- div with quadrant class -->
  1462. <div class="quadrant">
  1463. <station-info-box
  1464. :station="station"
  1465. :station-paused="stationPaused"
  1466. :show-manage-station="true"
  1467. />
  1468. </div>
  1469. <div id="sidebar-container" class="quadrant">
  1470. <station-sidebar />
  1471. </div>
  1472. </div>
  1473. <div id="station-right-column" class="column">
  1474. <div
  1475. class="experimental-listen-mode-container quadrant"
  1476. v-if="experimentalChangableListenModeEnabled"
  1477. v-show="
  1478. experimentalChangableListenMode ===
  1479. 'participate'
  1480. "
  1481. >
  1482. <h2>Want to listen to music?</h2>
  1483. <button
  1484. class="button is-primary"
  1485. @click="
  1486. experimentalChangableListenModeChange(
  1487. 'listen_and_participate'
  1488. )
  1489. "
  1490. >
  1491. <i class="material-icons icon-with-button"
  1492. >music_note</i
  1493. >
  1494. <span>Listen</span>
  1495. </button>
  1496. </div>
  1497. <div
  1498. class="player-container quadrant"
  1499. v-show="
  1500. !noSong &&
  1501. (!experimentalChangableListenModeEnabled ||
  1502. experimentalChangableListenMode ===
  1503. 'listen_and_participate')
  1504. "
  1505. >
  1506. <div
  1507. class="experimental-changable-listen-mode-player-header"
  1508. v-if="experimentalChangableListenModeEnabled"
  1509. >
  1510. <span
  1511. class="delete material-icons"
  1512. @click="
  1513. experimentalChangableListenModeChange(
  1514. 'participate'
  1515. )
  1516. "
  1517. >highlight_off</span
  1518. >
  1519. </div>
  1520. <div id="video-container">
  1521. <div
  1522. id="stationPlayer"
  1523. style="
  1524. width: 100%;
  1525. height: 100%;
  1526. min-height: 200px;
  1527. "
  1528. />
  1529. <div
  1530. class="player-cannot-autoplay"
  1531. v-if="!canAutoplay"
  1532. @click="increaseVolume()"
  1533. >
  1534. <p>
  1535. Please click anywhere on the screen for
  1536. the video to start
  1537. </p>
  1538. </div>
  1539. </div>
  1540. <div id="seeker-bar-container">
  1541. <div
  1542. id="seeker-bar"
  1543. :class="{
  1544. 'christmas-seeker': christmas,
  1545. nyan:
  1546. currentSong &&
  1547. currentSong.youtubeId ===
  1548. 'QH2-TGUlwu4'
  1549. }"
  1550. />
  1551. <div
  1552. class="seeker-bar-cover"
  1553. :style="{
  1554. width: `calc(100% - ${seekerbarPercentage}%)`
  1555. }"
  1556. ></div>
  1557. <img
  1558. v-if="
  1559. currentSong &&
  1560. currentSong.youtubeId === 'QH2-TGUlwu4'
  1561. "
  1562. src="https://freepngimg.com/thumb/nyan_cat/1-2-nyan-cat-free-download-png.png"
  1563. :style="{
  1564. position: 'absolute',
  1565. top: `-10px`,
  1566. left: `${seekerbarPercentage}%`,
  1567. width: '50px'
  1568. }"
  1569. />
  1570. <img
  1571. v-if="
  1572. currentSong &&
  1573. (currentSong.youtubeId ===
  1574. 'DtVBCG6ThDk' ||
  1575. currentSong.youtubeId ===
  1576. 'sI66hcu9fIs' ||
  1577. currentSong.youtubeId ===
  1578. 'iYYRH4apXDo' ||
  1579. currentSong.youtubeId ===
  1580. 'tRcPA7Fzebw')
  1581. "
  1582. src="/assets/rocket.svg"
  1583. :style="{
  1584. position: 'absolute',
  1585. top: `-21px`,
  1586. left: `calc(${seekerbarPercentage}% - 35px)`,
  1587. width: '50px',
  1588. transform: 'rotate(45deg)'
  1589. }"
  1590. />
  1591. <img
  1592. v-if="
  1593. currentSong &&
  1594. currentSong.youtubeId === 'jofNR_WkoCE'
  1595. "
  1596. src="/assets/fox.svg"
  1597. :style="{
  1598. position: 'absolute',
  1599. top: `-21px`,
  1600. left: `calc(${seekerbarPercentage}% - 35px)`,
  1601. width: '50px',
  1602. transform: 'scaleX(-1)',
  1603. opacity: 1
  1604. }"
  1605. />
  1606. <img
  1607. v-if="
  1608. currentSong &&
  1609. (currentSong.youtubeId ===
  1610. 'l9PxOanFjxQ' ||
  1611. currentSong.youtubeId ===
  1612. 'xKVcVSYmesU' ||
  1613. currentSong.youtubeId ===
  1614. '60ItHLz5WEA' ||
  1615. currentSong.youtubeId ===
  1616. 'e6vkFbtSGm0')
  1617. "
  1618. src="/assets/old_logo.png"
  1619. :style="{
  1620. position: 'absolute',
  1621. top: `-9px`,
  1622. left: `calc(${seekerbarPercentage}% - 22px)`,
  1623. 'background-color': 'rgb(96, 199, 169)',
  1624. width: '25px',
  1625. height: '25px',
  1626. 'border-radius': '25px'
  1627. }"
  1628. />
  1629. <img
  1630. v-if="
  1631. christmas &&
  1632. currentSong &&
  1633. ![
  1634. 'QH2-TGUlwu4',
  1635. 'DtVBCG6ThDk',
  1636. 'sI66hcu9fIs',
  1637. 'iYYRH4apXDo',
  1638. 'tRcPA7Fzebw',
  1639. 'jofNR_WkoCE',
  1640. 'l9PxOanFjxQ',
  1641. 'xKVcVSYmesU',
  1642. '60ItHLz5WEA',
  1643. 'e6vkFbtSGm0'
  1644. ].includes(currentSong.youtubeId)
  1645. "
  1646. src="/assets/santa.png"
  1647. :style="{
  1648. position: 'absolute',
  1649. top: `-30px`,
  1650. left: `calc(${seekerbarPercentage}% - 25px)`,
  1651. height: '50px',
  1652. transform: 'scaleX(-1)'
  1653. }"
  1654. />
  1655. </div>
  1656. <div id="control-bar-container">
  1657. <div id="left-buttons">
  1658. <!-- Debug Box -->
  1659. <button
  1660. v-if="frontendDevMode === 'development'"
  1661. class="button is-primary"
  1662. @click="togglePlayerDebugBox()"
  1663. @dblclick="resetPlayerDebugBox()"
  1664. content="Debug"
  1665. v-tippy
  1666. >
  1667. <i
  1668. class="material-icons icon-with-button"
  1669. >
  1670. bug_report
  1671. </i>
  1672. </button>
  1673. <!-- Local Pause/Resume Button -->
  1674. <button
  1675. class="button is-primary"
  1676. @click="resumeLocalStation()"
  1677. id="local-resume"
  1678. v-if="localPaused"
  1679. content="Unpause Playback"
  1680. v-tippy
  1681. >
  1682. <i class="material-icons">play_arrow</i>
  1683. </button>
  1684. <button
  1685. class="button is-primary"
  1686. @click="pauseLocalStation()"
  1687. id="local-pause"
  1688. v-else
  1689. content="Pause Playback"
  1690. v-tippy
  1691. >
  1692. <i class="material-icons">pause</i>
  1693. </button>
  1694. <!-- Vote to Skip Button -->
  1695. <button
  1696. v-if="!skipVotesLoaded"
  1697. class="button is-primary disabled"
  1698. content="Skip votes have not been loaded yet"
  1699. v-tippy
  1700. >
  1701. <i
  1702. class="material-icons icon-with-button"
  1703. >skip_next</i
  1704. >
  1705. </button>
  1706. <button
  1707. v-else-if="loggedIn"
  1708. :class="[
  1709. 'button',
  1710. 'is-primary',
  1711. { voted: currentSong.voted }
  1712. ]"
  1713. @click="toggleSkipVote()"
  1714. :content="`${
  1715. currentSong.voted
  1716. ? 'Remove vote'
  1717. : 'Vote'
  1718. } to Skip Song`"
  1719. v-tippy
  1720. >
  1721. <i
  1722. class="material-icons icon-with-button"
  1723. >skip_next</i
  1724. >
  1725. {{ currentSong.skipVotes }}
  1726. </button>
  1727. <button
  1728. v-else
  1729. class="button is-primary disabled"
  1730. content="Log in to vote to skip songs"
  1731. v-tippy="{ theme: 'info' }"
  1732. >
  1733. <i
  1734. class="material-icons icon-with-button"
  1735. >skip_next</i
  1736. >
  1737. {{ currentSong.skipVotes }}
  1738. </button>
  1739. </div>
  1740. <div id="duration">
  1741. <p>
  1742. {{ timeElapsed }} /
  1743. {{
  1744. utils.formatTime(
  1745. currentSong.duration
  1746. )
  1747. }}
  1748. </p>
  1749. </div>
  1750. <p id="volume-control" v-if="!isApple">
  1751. <i
  1752. class="material-icons"
  1753. @click="toggleMute()"
  1754. :content="`${
  1755. muted ? 'Unmute' : 'Mute'
  1756. }`"
  1757. v-tippy
  1758. >{{
  1759. muted
  1760. ? "volume_mute"
  1761. : volumeSliderValue >= 50
  1762. ? "volume_up"
  1763. : "volume_down"
  1764. }}</i
  1765. >
  1766. <input
  1767. v-model="volumeSliderValue"
  1768. type="range"
  1769. min="0"
  1770. max="100"
  1771. class="volume-slider active"
  1772. @change="changeVolume()"
  1773. @input="changeVolume()"
  1774. />
  1775. </p>
  1776. <div id="right-buttons" v-if="loggedIn">
  1777. <!-- Ratings (Like/Dislike) Buttons -->
  1778. <div
  1779. id="ratings"
  1780. v-if="ratingsLoaded && ownRatingsLoaded"
  1781. :class="{
  1782. liked: currentSong.liked,
  1783. disliked: currentSong.disliked
  1784. }"
  1785. >
  1786. <!-- Like Song Button -->
  1787. <button
  1788. class="button is-success like-song"
  1789. id="like-song"
  1790. @click="toggleLike()"
  1791. content="Like Song"
  1792. v-tippy
  1793. >
  1794. <i
  1795. class="material-icons icon-with-button"
  1796. :class="{
  1797. liked: currentSong.liked
  1798. }"
  1799. >thumb_up_alt</i
  1800. >{{ currentSong.likes }}
  1801. </button>
  1802. <!-- Dislike Song Button -->
  1803. <button
  1804. class="button is-danger dislike-song"
  1805. id="dislike-song"
  1806. @click="toggleDislike()"
  1807. content="Dislike Song"
  1808. v-tippy
  1809. >
  1810. <i
  1811. class="material-icons icon-with-button"
  1812. :class="{
  1813. disliked:
  1814. currentSong.disliked
  1815. }"
  1816. >thumb_down_alt</i
  1817. >{{ currentSong.dislikes }}
  1818. </button>
  1819. </div>
  1820. <div id="ratings" class="disabled" v-else>
  1821. <!-- Like Song Button -->
  1822. <button
  1823. class="button is-success like-song disabled"
  1824. id="like-song"
  1825. content="Ratings have not been loaded yet"
  1826. v-tippy
  1827. >
  1828. <i
  1829. class="material-icons icon-with-button"
  1830. >thumb_up_alt</i
  1831. >
  1832. </button>
  1833. <!-- Dislike Song Button -->
  1834. <button
  1835. class="button is-danger dislike-song disabled"
  1836. id="dislike-song"
  1837. content="Ratings have not been loaded yet"
  1838. v-tippy
  1839. >
  1840. <i
  1841. class="material-icons icon-with-button"
  1842. >thumb_down_alt</i
  1843. >
  1844. </button>
  1845. </div>
  1846. <!-- Add Song To Playlist Button & Dropdown -->
  1847. <add-to-playlist-dropdown
  1848. :song="currentSong"
  1849. placement="top-end"
  1850. >
  1851. <template #button>
  1852. <div
  1853. id="add-song-to-playlist"
  1854. content="Add Song to Playlist"
  1855. v-tippy
  1856. >
  1857. <div class="control has-addons">
  1858. <button
  1859. class="button is-primary"
  1860. >
  1861. <i
  1862. class="material-icons"
  1863. >
  1864. playlist_add
  1865. </i>
  1866. </button>
  1867. <button
  1868. class="button"
  1869. id="dropdown-toggle"
  1870. >
  1871. <i
  1872. class="material-icons"
  1873. >
  1874. {{
  1875. showPlaylistDropdown
  1876. ? "expand_more"
  1877. : "expand_less"
  1878. }}
  1879. </i>
  1880. </button>
  1881. </div>
  1882. </div>
  1883. </template>
  1884. </add-to-playlist-dropdown>
  1885. </div>
  1886. <div id="right-buttons" v-else>
  1887. <!-- Disabled Ratings (Like/Dislike) Buttons -->
  1888. <div id="ratings" v-if="ratingsLoaded">
  1889. <!-- Disabled Like Song Button -->
  1890. <button
  1891. class="button is-success disabled"
  1892. id="like-song"
  1893. content="Log in to like songs"
  1894. v-tippy="{ theme: 'info' }"
  1895. >
  1896. <i
  1897. class="material-icons icon-with-button"
  1898. >thumb_up_alt</i
  1899. >{{ currentSong.likes }}
  1900. </button>
  1901. <!-- Disabled Dislike Song Button -->
  1902. <button
  1903. class="button is-danger disabled"
  1904. id="dislike-song"
  1905. content="Log in to dislike songs"
  1906. v-tippy="{ theme: 'info' }"
  1907. >
  1908. <i
  1909. class="material-icons icon-with-button"
  1910. >thumb_down_alt</i
  1911. >{{ currentSong.dislikes }}
  1912. </button>
  1913. </div>
  1914. <div id="ratings" v-else>
  1915. <!-- Disabled Like Song Button -->
  1916. <button
  1917. class="button is-success disabled"
  1918. id="like-song"
  1919. content="Ratings have not been loaded yet"
  1920. v-tippy="{ theme: 'info' }"
  1921. >
  1922. <i
  1923. class="material-icons icon-with-button"
  1924. >thumb_up_alt</i
  1925. >
  1926. </button>
  1927. <!-- Disabled Dislike Song Button -->
  1928. <button
  1929. class="button is-danger disabled"
  1930. id="dislike-song"
  1931. content="Ratings have not been loaded yet"
  1932. v-tippy="{ theme: 'info' }"
  1933. >
  1934. <i
  1935. class="material-icons icon-with-button"
  1936. >thumb_down_alt</i
  1937. >
  1938. </button>
  1939. </div>
  1940. <!-- Disabled Add Song To Playlist Button & Dropdown -->
  1941. <div id="add-song-to-playlist">
  1942. <div class="control has-addons">
  1943. <button
  1944. class="button is-primary disabled"
  1945. content="Log in to add songs to playlist"
  1946. v-tippy="{ theme: 'info' }"
  1947. >
  1948. <i class="material-icons"
  1949. >queue</i
  1950. >
  1951. </button>
  1952. </div>
  1953. </div>
  1954. </div>
  1955. </div>
  1956. </div>
  1957. <p
  1958. class="player-container nothing-here-text"
  1959. v-if="noSong"
  1960. >
  1961. No song is currently playing
  1962. </p>
  1963. <div v-if="!noSong" id="current-next-row">
  1964. <div
  1965. id="currently-playing-container"
  1966. class="quadrant"
  1967. :class="{ 'no-currently-playing': noSong }"
  1968. >
  1969. <song-item
  1970. :key="`songItem-currentSong-${currentSong._id}`"
  1971. :song="currentSong"
  1972. :duration="false"
  1973. :requested-by="true"
  1974. header="Currently Playing.."
  1975. />
  1976. </div>
  1977. <div
  1978. v-if="nextSong"
  1979. id="next-up-container"
  1980. class="quadrant"
  1981. >
  1982. <song-item
  1983. :key="`songItem-nextSong-${nextSong._id}`"
  1984. :song="nextSong"
  1985. :duration="false"
  1986. :requested-by="true"
  1987. header="Next Up.."
  1988. />
  1989. </div>
  1990. </div>
  1991. </div>
  1992. </div>
  1993. </div>
  1994. <main-footer />
  1995. </div>
  1996. <floating-box
  1997. id="player-debug-box"
  1998. ref="playerDebugBox"
  1999. title="Station Debug"
  2000. >
  2001. <template #body>
  2002. <span><b>No song</b>: {{ noSong }}</span>
  2003. <span><b>Song id</b>: {{ currentSong._id }}</span>
  2004. <span><b>YouTube id</b>: {{ currentSong.youtubeId }}</span>
  2005. <span><b>Duration</b>: {{ currentSong.duration }}</span>
  2006. <span
  2007. ><b>Skip duration</b>: {{ currentSong.skipDuration }}</span
  2008. >
  2009. <span><b>Loading</b>: {{ loading }}</span>
  2010. <span><b>Can autoplay</b>: {{ canAutoplay }}</span>
  2011. <span><b>Player ready</b>: {{ playerReady }}</span>
  2012. <span
  2013. ><b>Attempts to play video</b>:
  2014. {{ attemptsToPlayVideo }}</span
  2015. >
  2016. <span
  2017. ><b>Last time requested if can autoplay</b>:
  2018. {{ lastTimeRequestedIfCanAutoplay }}</span
  2019. >
  2020. <span><b>Seeking</b>: {{ seeking }}</span>
  2021. <span><b>Playback rate</b>: {{ playbackRate }}</span>
  2022. <span><b>System difference</b>: {{ systemDifference }}</span>
  2023. <span><b>Time before paused</b>: {{ timeBeforePause }}</span>
  2024. <span><b>Time paused</b>: {{ timePaused }}</span>
  2025. <span><b>Time elapsed</b>: {{ timeElapsed }}</span>
  2026. <span><b>Volume slider value</b>: {{ volumeSliderValue }}</span>
  2027. <span><b>Local paused</b>: {{ localPaused }}</span>
  2028. <span><b>Station paused</b>: {{ stationPaused }}</span>
  2029. <span :title="new Date(pausedAt).toString()"
  2030. ><b>Paused at</b>: {{ pausedAt }}</span
  2031. >
  2032. <span :title="new Date(startedAt).toString()"
  2033. ><b>Started at</b>: {{ startedAt }}</span
  2034. >
  2035. <span
  2036. ><b>Requests enabled</b>:
  2037. {{ station.requests.enabled }}</span
  2038. >
  2039. <span
  2040. ><b>Requests access</b>: {{ station.requests.access }}</span
  2041. >
  2042. <span><b>Requests limit</b>: {{ station.requests.limit }}</span>
  2043. <span
  2044. ><b>Auto requesting playlists</b>:
  2045. {{
  2046. autoRequest.map(playlist => playlist._id).join(", ")
  2047. }}</span
  2048. >
  2049. <span
  2050. ><b>Autofill enabled</b>:
  2051. {{ station.autofill.enabled }}</span
  2052. >
  2053. <span><b>Autofill limit</b>: {{ station.autofill.limit }}</span>
  2054. <span><b>Autofill mode</b>: {{ station.autofill.mode }}</span>
  2055. <span><b>Skip votes loaded</b>: {{ skipVotesLoaded }}</span>
  2056. <span
  2057. ><b>Skip votes current</b>:
  2058. {{
  2059. currentSong.skipVotesCurrent
  2060. ? currentSong.skipVotesCurrent
  2061. : "N/A"
  2062. }}</span
  2063. >
  2064. <span
  2065. ><b>Skip votes</b>:
  2066. {{ skipVotesLoaded ? currentSong.skipVotes : "N/A" }}</span
  2067. >
  2068. <span><b>Ratings loaded</b>: {{ ratingsLoaded }}</span>
  2069. <span
  2070. ><b>Ratings</b>:
  2071. {{
  2072. ratingsLoaded
  2073. ? `${currentSong.likes} / ${currentSong.dislikes}`
  2074. : "N/A"
  2075. }}</span
  2076. >
  2077. <span><b>Own ratings loaded</b>: {{ ownRatingsLoaded }}</span>
  2078. <span
  2079. ><b>Own ratings</b>:
  2080. {{
  2081. ownRatingsLoaded
  2082. ? `${currentSong.liked} / ${currentSong.disliked}`
  2083. : "N/A"
  2084. }}</span
  2085. >
  2086. </template>
  2087. </floating-box>
  2088. <floating-box
  2089. id="keyboardShortcutsHelper"
  2090. ref="keyboardShortcutsHelper"
  2091. title="Station Keyboard Shortcuts"
  2092. >
  2093. <template #body>
  2094. <div>
  2095. <div
  2096. v-if="
  2097. hasPermission('stations.playback.toggle') ||
  2098. hasPermission('stations.skip')
  2099. "
  2100. >
  2101. <span class="biggest"><b>Admin/owner</b></span>
  2102. <span><b>Ctrl + Space</b> - Pause/resume station</span>
  2103. <span><b>Ctrl + Numpad right</b> - Skip station</span>
  2104. </div>
  2105. <hr
  2106. v-if="
  2107. hasPermission('stations.playback.toggle') ||
  2108. hasPermission('stations.skip')
  2109. "
  2110. />
  2111. <div>
  2112. <span class="biggest"><b>Volume</b></span>
  2113. <span
  2114. ><b>Ctrl + Numpad up/down</b> - Volume up/down
  2115. 10%</span
  2116. >
  2117. <span
  2118. ><b>Ctrl + Shift + Numpad up/down</b> - Volume
  2119. up/down 10%</span
  2120. >
  2121. </div>
  2122. <hr />
  2123. <div>
  2124. <span class="biggest"><b>Misc</b></span>
  2125. <span><b>Ctrl + D</b> - Toggles debug box</span>
  2126. <span><b>Ctrl + Shift + D</b> - Resets debug box</span>
  2127. <span
  2128. ><b>Ctrl + /</b> - Toggles keyboard shortcuts
  2129. box</span
  2130. >
  2131. <span
  2132. ><b>Ctrl + Shift + /</b> - Resets keyboard shortcuts
  2133. box</span
  2134. >
  2135. </div>
  2136. </div>
  2137. </template>
  2138. </floating-box>
  2139. <Z404 v-if="!exists"></Z404>
  2140. </div>
  2141. </template>
  2142. <style lang="less">
  2143. #stationPlayer {
  2144. position: absolute;
  2145. top: 0;
  2146. left: 0;
  2147. width: 100%;
  2148. height: 100%;
  2149. }
  2150. #currently-playing-container,
  2151. #next-up-container {
  2152. .song-item {
  2153. .thumbnail {
  2154. min-width: 130px;
  2155. width: 130px;
  2156. height: 130px;
  2157. }
  2158. }
  2159. }
  2160. #control-bar-container
  2161. #right-buttons
  2162. .tippy-box[data-theme~="dropdown"]
  2163. .nav-dropdown-items {
  2164. padding-bottom: 0 !important;
  2165. }
  2166. </style>
  2167. <style lang="less" scoped>
  2168. #page-loader-container {
  2169. height: inherit;
  2170. #page-loader-content {
  2171. height: inherit;
  2172. position: absolute;
  2173. max-width: 100%;
  2174. width: 1800px;
  2175. transform: translateX(-50%);
  2176. left: 50%;
  2177. }
  2178. #page-loader-layout {
  2179. height: inherit;
  2180. width: 100%;
  2181. }
  2182. }
  2183. #mobile-progress-animation {
  2184. width: 50px;
  2185. animation: rotate 0.8s infinite linear;
  2186. border: 8px solid var(--primary-color);
  2187. border-right-color: transparent;
  2188. border-radius: 50%;
  2189. height: 50px;
  2190. position: absolute;
  2191. top: 50%;
  2192. left: 50%;
  2193. display: none;
  2194. }
  2195. @keyframes rotate {
  2196. 0% {
  2197. transform: rotate(0deg);
  2198. }
  2199. 100% {
  2200. transform: rotate(360deg);
  2201. }
  2202. }
  2203. .nav,
  2204. .button.is-primary {
  2205. background-color: var(--primary-color) !important;
  2206. }
  2207. .button.is-primary:hover,
  2208. .button.is-primary:focus {
  2209. filter: brightness(90%);
  2210. }
  2211. .night-mode {
  2212. #currently-playing-container,
  2213. #next-up-container,
  2214. #control-bar-container,
  2215. .quadrant:not(#sidebar-container),
  2216. .player-container {
  2217. background-color: var(--dark-grey-3) !important;
  2218. }
  2219. #video-container,
  2220. #control-bar-container,
  2221. .quadrant:not(#sidebar-container),
  2222. .player-container {
  2223. border: 0 !important;
  2224. }
  2225. #seeker-bar-container {
  2226. background-color: var(--dark-grey-3) !important;
  2227. }
  2228. #dropdown-toggle {
  2229. background-color: var(--dark-grey-2) !important;
  2230. border: 0;
  2231. i {
  2232. color: var(--white);
  2233. }
  2234. }
  2235. }
  2236. #station-outer-container {
  2237. margin: 0 auto;
  2238. padding: 20px 40px;
  2239. min-height: calc(100vh - 64px);
  2240. width: 100%;
  2241. max-width: 1800px;
  2242. display: flex;
  2243. #station-inner-container {
  2244. width: 100%;
  2245. min-height: calc(100vh - 428px);
  2246. display: flex;
  2247. flex-direction: row;
  2248. flex-wrap: wrap;
  2249. .row {
  2250. display: flex;
  2251. flex-direction: row;
  2252. max-width: 100%;
  2253. }
  2254. .column {
  2255. display: flex;
  2256. flex-direction: column;
  2257. }
  2258. .quadrant {
  2259. border-radius: @border-radius;
  2260. margin: 10px;
  2261. overflow: hidden;
  2262. }
  2263. .quadrant:not(#sidebar-container) {
  2264. background-color: var(--white);
  2265. border: 1px solid var(--light-grey-3);
  2266. }
  2267. #station-left-column,
  2268. #station-right-column {
  2269. padding: 0;
  2270. }
  2271. #current-next-row {
  2272. display: flex;
  2273. flex-direction: row;
  2274. #currently-playing-container,
  2275. #next-up-container {
  2276. overflow: hidden;
  2277. flex-basis: 50%;
  2278. .song-item {
  2279. border: unset;
  2280. }
  2281. .nothing-here-text {
  2282. height: 100%;
  2283. }
  2284. }
  2285. > div:only-child {
  2286. flex: 1 !important;
  2287. flex-basis: 100% !important;
  2288. }
  2289. }
  2290. .player-container {
  2291. height: inherit;
  2292. background-color: var(--white);
  2293. display: flex;
  2294. flex-direction: column;
  2295. border: 1px solid var(--light-grey-3);
  2296. border-radius: @border-radius;
  2297. overflow: hidden;
  2298. &.nothing-here-text {
  2299. margin: 10px;
  2300. flex: 1;
  2301. min-height: 487px;
  2302. }
  2303. #video-container {
  2304. position: relative;
  2305. padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
  2306. height: 0;
  2307. overflow: hidden;
  2308. .player-cannot-autoplay {
  2309. position: relative;
  2310. width: 100%;
  2311. height: 100%;
  2312. bottom: calc(100% + 5px);
  2313. background: var(--primary-color);
  2314. display: flex;
  2315. align-items: center;
  2316. justify-content: center;
  2317. p {
  2318. color: var(--white);
  2319. font-size: 26px;
  2320. text-align: center;
  2321. }
  2322. }
  2323. }
  2324. #seeker-bar-container {
  2325. background-color: var(--white);
  2326. position: relative;
  2327. height: 7px;
  2328. display: block;
  2329. width: 100%;
  2330. #seeker-bar {
  2331. background-color: var(--primary-color);
  2332. top: 0;
  2333. left: 0;
  2334. bottom: 0;
  2335. position: absolute;
  2336. width: 100%;
  2337. }
  2338. .seeker-bar-cover {
  2339. position: absolute;
  2340. top: 0;
  2341. right: 0;
  2342. bottom: 0;
  2343. background-color: inherit;
  2344. }
  2345. }
  2346. #control-bar-container {
  2347. display: flex;
  2348. justify-content: space-around;
  2349. padding: 10px 0;
  2350. width: 100%;
  2351. background: var(--white);
  2352. flex-direction: column;
  2353. flex-flow: wrap;
  2354. .button:not(#dropdown-toggle) {
  2355. width: 75px;
  2356. }
  2357. #left-buttons,
  2358. #right-buttons {
  2359. margin: 3px;
  2360. }
  2361. #left-buttons {
  2362. display: flex;
  2363. .button:not(:first-of-type) {
  2364. margin-left: 5px;
  2365. }
  2366. .disabled {
  2367. filter: grayscale(0.4);
  2368. }
  2369. }
  2370. #duration {
  2371. margin: 3px;
  2372. display: flex;
  2373. align-items: center;
  2374. p {
  2375. font-size: 22px;
  2376. /** prevents duration width slightly varying and shifting other controls slightly */
  2377. width: 150px;
  2378. text-align: center;
  2379. }
  2380. }
  2381. #volume-control {
  2382. margin: 3px;
  2383. margin-top: 0;
  2384. display: flex;
  2385. align-items: center;
  2386. cursor: pointer;
  2387. .volume-slider {
  2388. width: 100%;
  2389. padding: 0 15px;
  2390. background: transparent;
  2391. min-width: 100px;
  2392. }
  2393. input[type="range"] {
  2394. -webkit-appearance: none;
  2395. margin: 7.3px 0;
  2396. }
  2397. input[type="range"]:focus {
  2398. outline: none;
  2399. }
  2400. input[type="range"]::-webkit-slider-runnable-track {
  2401. width: 100%;
  2402. height: 5.2px;
  2403. cursor: pointer;
  2404. box-shadow: 0;
  2405. background: var(--light-grey-3);
  2406. border-radius: @border-radius;
  2407. border: 0;
  2408. }
  2409. input[type="range"]::-webkit-slider-thumb {
  2410. box-shadow: 0;
  2411. border: 0;
  2412. height: 19px;
  2413. width: 19px;
  2414. border-radius: 100%;
  2415. background: var(--primary-color);
  2416. cursor: pointer;
  2417. -webkit-appearance: none;
  2418. margin-top: -6.5px;
  2419. }
  2420. input[type="range"]::-moz-range-track {
  2421. width: 100%;
  2422. height: 5.2px;
  2423. cursor: pointer;
  2424. box-shadow: 0;
  2425. background: var(--light-grey-3);
  2426. border-radius: @border-radius;
  2427. border: 0;
  2428. }
  2429. input[type="range"]::-moz-range-thumb {
  2430. box-shadow: 0;
  2431. border: 0;
  2432. height: 19px;
  2433. width: 19px;
  2434. border-radius: 100%;
  2435. background: var(--primary-color);
  2436. cursor: pointer;
  2437. -webkit-appearance: none;
  2438. margin-top: -6.5px;
  2439. }
  2440. input[type="range"]::-ms-track {
  2441. width: 100%;
  2442. height: 5.2px;
  2443. cursor: pointer;
  2444. box-shadow: 0;
  2445. background: var(--light-grey-3);
  2446. border-radius: @border-radius;
  2447. }
  2448. input[type="range"]::-ms-fill-lower {
  2449. background: var(--light-grey-3);
  2450. border: 0;
  2451. border-radius: 0;
  2452. box-shadow: 0;
  2453. }
  2454. input[type="range"]::-ms-fill-upper {
  2455. background: var(--light-grey-3);
  2456. border: 0;
  2457. border-radius: 0;
  2458. box-shadow: 0;
  2459. }
  2460. input[type="range"]::-ms-thumb {
  2461. box-shadow: 0;
  2462. border: 0;
  2463. height: 15px;
  2464. width: 15px;
  2465. border-radius: 100%;
  2466. background: var(--primary-color);
  2467. cursor: pointer;
  2468. -webkit-appearance: none;
  2469. margin-top: 1.5px;
  2470. }
  2471. }
  2472. #right-buttons {
  2473. display: flex;
  2474. #dropdown-toggle {
  2475. width: 35px;
  2476. }
  2477. #dislike-song,
  2478. #add-song-to-playlist .button:not(#dropdown-toggle) {
  2479. margin-left: 5px;
  2480. }
  2481. #ratings {
  2482. display: flex;
  2483. &.liked #dislike-song,
  2484. &.disliked #like-song {
  2485. background-color: var(--grey) !important;
  2486. }
  2487. #like-song.disabled,
  2488. #dislike-song.disabled {
  2489. filter: grayscale(0.4);
  2490. }
  2491. }
  2492. #add-song-to-playlist {
  2493. display: flex;
  2494. flex-direction: column-reverse;
  2495. #nav-dropdown {
  2496. position: absolute;
  2497. margin-left: 4px;
  2498. margin-bottom: 36px;
  2499. .nav-dropdown-items {
  2500. position: relative;
  2501. right: calc(100% - 110px);
  2502. }
  2503. }
  2504. .control {
  2505. width: fit-content;
  2506. margin-bottom: 0 !important;
  2507. button.disabled {
  2508. filter: grayscale(0.4);
  2509. border-radius: @border-radius;
  2510. &::after {
  2511. margin-right: 100%;
  2512. }
  2513. }
  2514. }
  2515. }
  2516. }
  2517. }
  2518. }
  2519. #sidebar-container {
  2520. border-top: 0;
  2521. position: relative;
  2522. height: inherit;
  2523. flex-grow: 1;
  2524. min-height: 350px;
  2525. }
  2526. }
  2527. }
  2528. .footer {
  2529. margin-top: 30px;
  2530. }
  2531. .nyan {
  2532. background: linear-gradient(
  2533. 90deg,
  2534. magenta 0%,
  2535. red 15%,
  2536. orange 30%,
  2537. yellow 45%,
  2538. lime 60%,
  2539. cyan 75%,
  2540. blue 90%,
  2541. magenta 100%
  2542. );
  2543. background-size: 200%;
  2544. animation: nyanMoving 4s linear infinite;
  2545. }
  2546. @keyframes nyanMoving {
  2547. 0% {
  2548. background-position: 0% 0%;
  2549. }
  2550. 100% {
  2551. background-position: -200% 0%;
  2552. }
  2553. }
  2554. .christmas-seeker {
  2555. background: repeating-linear-gradient(
  2556. -45deg,
  2557. var(--white) 0 1rem,
  2558. var(--dark-red) 1rem 2rem
  2559. );
  2560. background-size: 200% 200%;
  2561. animation: christmas 20s linear infinite;
  2562. }
  2563. @keyframes christmas {
  2564. 100% {
  2565. background-position: 80% 100%;
  2566. }
  2567. }
  2568. .bg-bubbles {
  2569. top: 0;
  2570. left: 0;
  2571. width: 100%;
  2572. height: 100%;
  2573. position: absolute;
  2574. z-index: -1;
  2575. margin: 0px;
  2576. pointer-events: none;
  2577. }
  2578. .bg-bubbles li {
  2579. position: absolute;
  2580. list-style: none;
  2581. display: block;
  2582. width: 40px;
  2583. height: 40px;
  2584. border-radius: 100px;
  2585. background-color: var(--primary-color);
  2586. opacity: 0.15;
  2587. bottom: 0px;
  2588. -webkit-animation: square 25s infinite;
  2589. animation: square 25s infinite;
  2590. -webkit-transition-timing-function: linear;
  2591. transition-timing-function: linear;
  2592. }
  2593. .bg-bubbles li:nth-child(1) {
  2594. left: 10%;
  2595. }
  2596. .bg-bubbles li:nth-child(2) {
  2597. left: 20%;
  2598. width: 80px;
  2599. height: 80px;
  2600. -webkit-animation-delay: 2s;
  2601. animation-delay: 2s;
  2602. -webkit-animation-duration: 17s;
  2603. animation-duration: 17s;
  2604. }
  2605. .bg-bubbles li:nth-child(3) {
  2606. left: 25%;
  2607. -webkit-animation-delay: 4s;
  2608. animation-delay: 4s;
  2609. }
  2610. .bg-bubbles li:nth-child(4) {
  2611. left: 40%;
  2612. width: 60px;
  2613. height: 60px;
  2614. -webkit-animation-duration: 22s;
  2615. animation-duration: 22s;
  2616. background-color: var(--primary-color);
  2617. opacity: 0.25;
  2618. }
  2619. .bg-bubbles li:nth-child(5) {
  2620. left: 70%;
  2621. }
  2622. .bg-bubbles li:nth-child(6) {
  2623. left: 80%;
  2624. width: 120px;
  2625. height: 120px;
  2626. -webkit-animation-delay: 3s;
  2627. animation-delay: 3s;
  2628. background-color: var(--primary-color);
  2629. opacity: 0.2;
  2630. }
  2631. .bg-bubbles li:nth-child(7) {
  2632. left: 32%;
  2633. width: 160px;
  2634. height: 160px;
  2635. -webkit-animation-delay: 7s;
  2636. animation-delay: 7s;
  2637. }
  2638. .bg-bubbles li:nth-child(8) {
  2639. left: 55%;
  2640. width: 20px;
  2641. height: 20px;
  2642. -webkit-animation-delay: 15s;
  2643. animation-delay: 15s;
  2644. -webkit-animation-duration: 40s;
  2645. animation-duration: 40s;
  2646. }
  2647. .bg-bubbles li:nth-child(9) {
  2648. left: 25%;
  2649. width: 10px;
  2650. height: 10px;
  2651. -webkit-animation-delay: 2s;
  2652. animation-delay: 2s;
  2653. -webkit-animation-duration: 40s;
  2654. animation-duration: 40s;
  2655. background-color: var(--primary-color);
  2656. opacity: 0.3;
  2657. }
  2658. .bg-bubbles li:nth-child(10) {
  2659. left: 80%;
  2660. width: 160px;
  2661. height: 160px;
  2662. -webkit-animation-delay: 11s;
  2663. animation-delay: 11s;
  2664. }
  2665. .experimental-listen-mode-container {
  2666. display: flex;
  2667. flex-direction: column;
  2668. justify-content: center;
  2669. row-gap: 8px;
  2670. padding: 16px 16px;
  2671. h2 {
  2672. margin: 0;
  2673. font-size: 20px;
  2674. }
  2675. }
  2676. .experimental-changable-listen-mode-player-header {
  2677. padding: 4px;
  2678. display: flex;
  2679. flex-direction: row-reverse;
  2680. .delete {
  2681. cursor: pointer;
  2682. }
  2683. }
  2684. /* Tablet view fix */
  2685. @media (max-width: 768px) {
  2686. .bg-bubbles li:nth-child(10) {
  2687. display: none;
  2688. }
  2689. }
  2690. @-webkit-keyframes square {
  2691. 0% {
  2692. -webkit-transform: translateY(0);
  2693. transform: translateY(0);
  2694. }
  2695. 100% {
  2696. -webkit-transform: translateY(-700px) rotate(600deg);
  2697. transform: translateY(-700px) rotate(600deg);
  2698. }
  2699. }
  2700. @keyframes square {
  2701. 0% {
  2702. -webkit-transform: translateY(0);
  2703. transform: translateY(0);
  2704. }
  2705. 100% {
  2706. -webkit-transform: translateY(-700px) rotate(600deg);
  2707. transform: translateY(-700px) rotate(600deg);
  2708. }
  2709. }
  2710. :deep(.nothing-here-text) {
  2711. display: flex;
  2712. align-items: center;
  2713. justify-content: center;
  2714. }
  2715. @media (min-width: 1500px) {
  2716. #station-left-column {
  2717. max-width: 650px;
  2718. }
  2719. #station-right-column {
  2720. max-width: calc(100% - 650px);
  2721. }
  2722. }
  2723. @media (max-width: 1700px) {
  2724. #current-next-row {
  2725. flex-direction: column !important;
  2726. > div {
  2727. flex: 1 !important;
  2728. }
  2729. }
  2730. }
  2731. @media (max-width: 1500px) {
  2732. #mobile-progress-animation {
  2733. display: block;
  2734. }
  2735. #page-loader-container {
  2736. display: none;
  2737. }
  2738. #station-outer-container {
  2739. max-width: 1500px;
  2740. #station-inner-container {
  2741. flex-direction: row;
  2742. #station-left-column {
  2743. #about-station-container #admin-buttons {
  2744. flex-wrap: wrap;
  2745. }
  2746. #sidebar-container {
  2747. min-height: 350px;
  2748. }
  2749. }
  2750. #station-right-column {
  2751. #current-next-row {
  2752. flex-direction: column;
  2753. }
  2754. #control-bar-container {
  2755. #duration,
  2756. #volume-control,
  2757. #right-buttons,
  2758. #left-buttons {
  2759. margin-bottom: 5px;
  2760. justify-content: center;
  2761. }
  2762. #duration {
  2763. order: 1;
  2764. }
  2765. #volume-control {
  2766. order: 2;
  2767. max-width: 400px;
  2768. }
  2769. #right-buttons {
  2770. order: 3;
  2771. flex-wrap: wrap;
  2772. #ratings {
  2773. flex-wrap: wrap;
  2774. }
  2775. }
  2776. #left-buttons {
  2777. order: 4;
  2778. flex-wrap: wrap;
  2779. }
  2780. }
  2781. }
  2782. }
  2783. }
  2784. }
  2785. @media (max-width: 1200px) {
  2786. #station-outer-container {
  2787. max-width: 900px;
  2788. padding: 0;
  2789. #station-inner-container {
  2790. flex-direction: column-reverse;
  2791. flex-wrap: nowrap;
  2792. }
  2793. }
  2794. }
  2795. @media (max-width: 990px) {
  2796. #station-outer-container {
  2797. min-height: calc(
  2798. 100vh - 256px
  2799. ); // Height of nav (64px) + height of footer (190px)
  2800. }
  2801. }
  2802. </style>