index.vue 77 KB

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