index.vue 87 KB

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