index.vue 86 KB

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