index.vue 87 KB

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