index.vue 87 KB

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