index.vue 87 KB

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