index.vue 87 KB

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