12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758 |
- <script setup lang="ts">
- import {
- defineAsyncComponent,
- ref,
- computed,
- watch,
- onMounted,
- onBeforeUnmount
- } from "vue";
- import { useRoute, useRouter } from "vue-router";
- import Toast from "toasters";
- import { storeToRefs } from "pinia";
- import { ContentLoader } from "vue-content-loader";
- import canAutoPlay from "can-autoplay";
- import { useSoundcloudPlayer } from "@/composables/useSoundcloudPlayer";
- import { useWebsocketsStore } from "@/stores/websockets";
- import { useConfigStore } from "@/stores/config";
- import { useStationStore } from "@/stores/station";
- import { useUserAuthStore } from "@/stores/userAuth";
- import { useUserPreferencesStore } from "@/stores/userPreferences";
- import { useModalsStore } from "@/stores/modals";
- import aw from "@/aw";
- import ms from "@/ms";
- import keyboardShortcuts from "@/keyboardShortcuts";
- import utils from "@/utils";
- const TAG = "[STATION]";
- const MainHeader = defineAsyncComponent(
- () => import("@/components/MainHeader.vue")
- );
- const MainFooter = defineAsyncComponent(
- () => import("@/components/MainFooter.vue")
- );
- const FloatingBox = defineAsyncComponent(
- () => import("@/components/FloatingBox.vue")
- );
- const StationInfoBox = defineAsyncComponent(
- () => import("@/components/StationInfoBox.vue")
- );
- const AddToPlaylistDropdown = defineAsyncComponent(
- () => import("@/components/AddToPlaylistDropdown.vue")
- );
- const MediaItem = defineAsyncComponent(
- () => import("@/components/MediaItem.vue")
- );
- const Z404 = defineAsyncComponent(() => import("@/pages/404.vue"));
- const StationSidebar = defineAsyncComponent(
- () => import("./Sidebar/index.vue")
- );
- const route = useRoute();
- const router = useRouter();
- const { socket } = useWebsocketsStore();
- const configStore = useConfigStore();
- const { experimental, primaryColor, sitename, christmas } =
- storeToRefs(configStore);
- const stationStore = useStationStore();
- const userAuthStore = useUserAuthStore();
- const userPreferencesStore = useUserPreferencesStore();
- const {
- soundcloudIframeElement,
- soundcloudLoadTrack,
- soundcloudSeekTo,
- soundcloudPlay,
- soundcloudPause,
- soundcloudSetVolume,
- soundcloudGetPosition,
- soundcloudGetTrackState,
- soundcloudBindListener,
- soundcloudOnTrackStateChange,
- soundcloudDestroy,
- soundcloudUnload
- } = useSoundcloudPlayer();
- // TODO this might need a different place, like onMounted
- const isApple = ref(
- navigator.platform.match(/iPhone|iPod|iPad/) ||
- navigator.vendor === "Apple Computer, Inc."
- );
- const loading = ref(true);
- const exists = ref(true);
- const youtubePlayerReady = ref(false);
- const youtubePlayer = ref(undefined);
- const timePaused = ref(0);
- const muted = ref(false);
- const timeElapsed = ref("0:00");
- const timeBeforePause = ref(0);
- const systemDifference = ref(0);
- const attemptsToPlayVideo = ref(0);
- const canAutoplay = ref(true);
- const lastTimeRequestedIfCanAutoplay = ref(0);
- const seeking = ref(false);
- const playbackRate = ref(1);
- const volumeSliderValue = ref(0);
- const showPlaylistDropdown = ref(false);
- const seekerbarPercentage = ref(0);
- const frontendDevMode = ref("production");
- const activityWatchMediaDataInterval = ref(null);
- const activityWatchMediaLastStatus = ref("");
- const activityWatchMediaLastMediaSource = ref("");
- const activityWatchMediaLastStartDuration = ref(0);
- const reportStationStateInterval = ref(null);
- const nextCurrentSong = ref(null);
- const mediaModalWatcher = ref(null);
- const beforeMediaModalLocalPausedLock = ref(false);
- const beforeMediaModalLocalPaused = ref(null);
- const persistentToastCheckerInterval = ref(null);
- const persistentToasts = ref([]);
- // Experimental options
- const experimentalChangableListenModeEnabled = ref(false);
- const experimentalChangableListenMode = ref("listen_and_participate"); // Can be either listen_and_participate or participate
- // End experimental options
- const videoLoading = ref();
- const startedAt = ref();
- const pausedAt = ref();
- const stationIdentifier = ref();
- const calculateTimeDifferenceTimeout = ref();
- const playerDebugBox = ref();
- const keyboardShortcutsHelper = ref();
- const autoPaused = ref(false);
- const modalsStore = useModalsStore();
- const { activeModals } = storeToRefs(modalsStore);
- // TODO fix this if it still has some use, as this is no longer accurate
- // const video = computed(() => store.state.modals.editSong);
- const { loggedIn, userId } = storeToRefs(userAuthStore);
- const { nightmode, autoSkipDisliked } = storeToRefs(userPreferencesStore);
- const {
- station,
- currentSong,
- nextSong,
- songsList,
- stationPaused,
- localPaused,
- noSong,
- autoRequest,
- autoRequestLock,
- autorequestExcludedMediaSources
- } = storeToRefs(stationStore);
- const youtubePlayerState = ref<
- null | "UNSTARTED" | "ENDED" | "PLAYING" | "PAUSED" | "BUFFERING" | "CUED"
- >(null);
- const skipVotesLoaded = computed(
- () =>
- !noSong.value &&
- Number.isInteger(currentSong.value.skipVotes) &&
- currentSong.value.skipVotes >= 0
- );
- const ratingsLoaded = computed(
- () =>
- !noSong.value &&
- Number.isInteger(currentSong.value.likes) &&
- Number.isInteger(currentSong.value.dislikes) &&
- currentSong.value.likes >= 0 &&
- currentSong.value.dislikes >= 0
- );
- const ownRatingsLoaded = computed(
- () =>
- !noSong.value &&
- typeof currentSong.value.liked === "boolean" &&
- typeof currentSong.value.disliked === "boolean"
- );
- const aModalIsOpen = computed(() => Object.keys(activeModals.value).length > 0);
- const currentUserQueueSongs = computed(
- () =>
- songsList.value.filter(
- queueSong => queueSong.requestedBy === userId.value
- ).length
- );
- const currentSongMediaType = computed(() => {
- if (
- !currentSong.value ||
- !currentSong.value.mediaSource ||
- currentSong.value.mediaSource.indexOf(":") === -1
- )
- return "none";
- return currentSong.value.mediaSource.split(":")[0];
- });
- const currentSongMediaValue = computed(() => {
- if (
- !currentSong.value ||
- !currentSong.value.mediaSource ||
- currentSong.value.mediaSource.indexOf(":") === -1
- )
- return null;
- return currentSong.value.mediaSource.split(":")[1];
- });
- const currentYoutubeId = computed(() => {
- if (
- !currentSong.value ||
- !currentSong.value.mediaSource.startsWith("youtube:")
- )
- return null;
- return currentSong.value.mediaSource.split(":")[1];
- });
- const stationState = computed(() => {
- if (noSong.value) return "no_song";
- if (stationPaused.value) return "station_paused";
- if (
- experimentalChangableListenModeEnabled.value &&
- experimentalChangableListenMode.value === "participate"
- )
- return "participate";
- if (localPaused.value) return "local_paused";
- if (volumeSliderValue.value === 0 || muted.value) return "muted";
- if (currentSongMediaType.value === "youtube" && youtubePlayerReady.value) {
- if (youtubePlayerState.value === "PLAYING") return "playing";
- if (youtubePlayerState.value === "BUFFERING") return "buffering";
- }
- if (
- currentSongMediaType.value === "soundcloud" &&
- soundcloudGetTrackState() === "playing"
- )
- return "playing";
- if (autoPaused.value) return "unavailable";
- return "unknown";
- });
- const {
- joinStation,
- leaveStation,
- updateStation,
- updateUserCount,
- updateUsers,
- updateCurrentSong,
- updateNextSong,
- updateSongsList,
- reorderSongsList,
- updateStationPaused,
- updateLocalPaused,
- updateNoSong,
- updateIfStationIsFavorited,
- setAutofillPlaylists,
- setBlacklist,
- updateCurrentSongRatings,
- updateOwnCurrentSongRatings,
- updateCurrentSongSkipVotes,
- updateAutoRequestLock,
- updateAutorequestLocalStorage,
- hasPermission,
- addDj,
- removeDj,
- updatePermissions,
- addHistoryItem,
- setHistory
- } = stationStore;
- // TODO fix this if it still has some use
- // const stopVideo = payload =>
- // store.dispatch("modals/editSong/stopVideo", payload);
- const calculateTimeDifference = (firstRun = false) => {
- if (localStorage.getItem("stationNoSystemTimeDifference") === "true") {
- console.log(
- "Not calculating time different because 'stationNoSystemTimeDifference' is 'true' in localStorage"
- );
- return;
- }
- if (!station.value._id) return;
- if (calculateTimeDifferenceTimeout.value)
- clearTimeout(calculateTimeDifferenceTimeout.value);
- // Store the current time in ms before we send a ping to the backend
- const beforePing = Date.now();
- socket.dispatch("apis.ping", res => {
- if (res.status === "success") {
- // Store the current time in ms after we receive a pong from the backend
- const afterPing = Date.now();
- // Calculate the approximate latency between the client and the backend, by taking the time the request took and dividing it in 2
- // This is not perfect, as the request could take longer to get to the server than be sent back, or the other way around
- let connectionLatency = (afterPing - beforePing) / 2;
- console.log(
- `Latency between client and server: ${connectionLatency}ms`,
- beforePing,
- afterPing
- );
- // If we have a station latency in localStorage, use that. Can be used for debugging.
- if (localStorage.getItem("stationLatency")) {
- connectionLatency = parseInt(
- localStorage.getItem("stationLatency")
- );
- console.log(
- `Using latency from local storage: ${connectionLatency}ms`
- );
- }
- // Store the server time in ms that the server had before sending the pong
- const serverDate = res.data.date;
- // Calculates the approximate different in system time that the current client has, compared to the system time of the backend
- // Takes into account the approximate latency, so if it took approximately 500ms between the backend sending the pong, and the client receiving the pong,
- // the system time from the backend has to have 500ms added for it to be correct
- const difference = serverDate + connectionLatency - afterPing;
- console.log(
- `Difference in system time compared to server: ${difference}ms`
- );
- if (Math.abs(difference) > 3000) {
- console.log("System time difference is bigger than 3 seconds.");
- }
- // Gets how many ms. difference there is between the last time this function was called and now
- const differenceBetweenLastTime = Math.abs(
- systemDifference.value - difference
- );
- systemDifference.value = difference;
- // By default, we want to re-run this function every 5 minutes
- let timeoutTime = 1000 * 300;
- // If this is the first time this command is called, we want to re-run this function after 15 seconds
- // Also, if the system time difference is more than 500ms different from last time, we also want to re-run after 15 seconds
- if (firstRun || differenceBetweenLastTime > 500) {
- timeoutTime = 1000 * 15;
- }
- console.log(
- `Will attempt to get system time difference again in ${
- timeoutTime / 1000
- } seconds.`
- );
- if (calculateTimeDifferenceTimeout.value)
- clearTimeout(calculateTimeDifferenceTimeout.value);
- calculateTimeDifferenceTimeout.value = setTimeout(() => {
- calculateTimeDifference();
- }, timeoutTime);
- }
- });
- };
- const updateMediaSessionData = song => {
- if (song) {
- ms.setMediaSessionData(
- 0,
- !localPaused.value && !stationPaused.value && !autoPaused.value, // This should be improved later
- song.title,
- song.artists ? song.artists.join(", ") : null,
- null,
- song.thumbnail ||
- `https://img.youtube.com/vi/${song.youtubeId}/mqdefault.jpg`
- );
- } else ms.removeMediaSessionData(0);
- };
- const autoRequestSong = () => {
- const { limit, allowAutorequest, autorequestLimit } =
- station.value.requests;
- if (autoRequestLock.value) return;
- if (!allowAutorequest) return;
- if (autoRequest.value.length === 0) return;
- updateAutorequestLocalStorage();
- if (currentUserQueueSongs.value >= limit) return;
- if (currentUserQueueSongs.value >= autorequestLimit) return;
- if (songsList.value.length >= 50) return;
- const uniqueMediaSources = new Set();
- autoRequest.value.forEach(playlist => {
- playlist.songs.forEach(song => {
- if (
- autorequestExcludedMediaSources.value.indexOf(
- song.mediaSource
- ) !== -1
- )
- return;
- if (song.mediaSource.startsWith("spotify:")) return;
- if (
- !experimental.value.soundcloud &&
- song.mediaSource.startsWith("soundcloud:")
- )
- return;
- uniqueMediaSources.add(song.mediaSource);
- });
- });
- if (uniqueMediaSources.size > 0) {
- const mediaSource = Array.from(uniqueMediaSources.values())[
- Math.floor(Math.random() * uniqueMediaSources.size)
- ];
- updateAutoRequestLock(true);
- socket.dispatch(
- "stations.addToQueue",
- station.value._id,
- mediaSource,
- "autorequest",
- data => {
- updateAutoRequestLock(false);
- setTimeout(
- () => {
- autoRequestSong();
- },
- data.message === "That song is already in the queue."
- ? 5000
- : 1000
- );
- }
- );
- }
- };
- const dateCurrently = () => new Date().getTime() + systemDifference.value;
- const getTimeElapsed = () => {
- if (currentSong.value) {
- let localTimePaused = timePaused.value;
- if (stationPaused.value)
- localTimePaused += dateCurrently() - pausedAt.value;
- return dateCurrently() - startedAt.value - localTimePaused;
- }
- return 0;
- };
- const getTimeRemaining = () => {
- if (currentSong.value) {
- return currentSong.value.duration * 1000 - getTimeElapsed();
- }
- return 0;
- };
- const getCurrentPlayerTime = () =>
- new Promise<number>(resolve => {
- if (
- currentSongMediaType.value === "youtube" &&
- youtubePlayerReady.value
- ) {
- resolve(
- Math.max(
- youtubePlayer.value.getCurrentTime() -
- currentSong.value.skipDuration,
- 0
- ) * 1000
- );
- return;
- }
- if (currentSongMediaType.value === "soundcloud") {
- soundcloudGetPosition(position => {
- resolve(
- Math.max(
- position / 1000 - currentSong.value.skipDuration,
- 0
- ) * 1000
- );
- });
- return;
- }
- resolve(0);
- });
- const skipSong = () => {
- if (nextCurrentSong.value && nextCurrentSong.value.currentSong) {
- const _songsList = songsList.value.concat([]);
- if (
- _songsList.length > 0 &&
- _songsList[0].mediaSource ===
- nextCurrentSong.value.currentSong.mediaSource
- ) {
- _songsList.splice(0, 1);
- updateSongsList(_songsList);
- }
- // TODO fix
- // eslint-disable-next-line
- setCurrentSong(nextCurrentSong.value);
- } else {
- // TODO fix
- // eslint-disable-next-line
- setCurrentSong({
- currentSong: null,
- startedAt: 0,
- paused: stationPaused.value,
- timePaused: 0,
- pausedAt: 0
- });
- }
- };
- const setNextCurrentSong = (_nextCurrentSong, skipSkipCheck = false) => {
- nextCurrentSong.value = _nextCurrentSong;
- // If skipSkipCheck is true, it won't try to skip the song
- if (getTimeRemaining() <= 0 && !skipSkipCheck) {
- skipSong();
- }
- };
- const resizeSeekerbar = () => {
- seekerbarPercentage.value =
- (getTimeElapsed() / 1000 / currentSong.value.duration) * 100;
- };
- const playerSeekTo = position => {
- console.debug("PLAYER SEEK TO", position);
- // Position is in seconds
- if (currentSongMediaType.value === "youtube" && youtubePlayerReady.value) {
- youtubePlayer.value.seekTo(position);
- }
- if (currentSongMediaType.value === "soundcloud") {
- soundcloudSeekTo(position * 1000);
- }
- };
- const playerPause = () => {
- if (youtubePlayerReady.value) {
- youtubePlayer.value.pauseVideo();
- }
- soundcloudPause();
- };
- const calculateTimeElapsed = async () => {
- if (experimentalChangableListenMode.value === "participate") return;
- if (
- youtubePlayerReady.value &&
- currentSongMediaType.value === "youtube" &&
- !noSong.value &&
- currentSong.value &&
- youtubePlayer.value?.getPlayerState() === -1
- ) {
- if (!canAutoplay.value) {
- if (Date.now() - lastTimeRequestedIfCanAutoplay.value > 2000) {
- lastTimeRequestedIfCanAutoplay.value = Date.now();
- canAutoPlay.video().then(({ result }) => {
- if (result) {
- attemptsToPlayVideo.value = 0;
- canAutoplay.value = true;
- } else {
- canAutoplay.value = false;
- }
- });
- }
- } else if (!stationPaused.value && !localPaused.value) {
- youtubePlayer.value.playVideo();
- attemptsToPlayVideo.value += 1;
- }
- }
- if (
- !stationPaused.value &&
- !localPaused.value &&
- !autoPaused.value &&
- !isApple.value
- ) {
- const timeElapsed = getTimeElapsed();
- const currentPlayerTime = await getCurrentPlayerTime();
- const difference = timeElapsed - currentPlayerTime;
- let _playbackRate = 1;
- if (difference < -2000) {
- if (!seeking.value) {
- seeking.value = true;
- playerSeekTo(
- getTimeElapsed() / 1000 + currentSong.value.skipDuration
- );
- }
- } else if (difference < -200) {
- _playbackRate = 0.8;
- } else if (difference < -50) {
- _playbackRate = 0.9;
- } else if (difference < -25) {
- _playbackRate = 0.95;
- } else if (difference > 2000) {
- if (!seeking.value) {
- seeking.value = true;
- playerSeekTo(
- getTimeElapsed() / 1000 + currentSong.value.skipDuration
- );
- }
- } else if (difference > 200) {
- _playbackRate = 1.2;
- } else if (difference > 50) {
- _playbackRate = 1.1;
- } else if (difference > 25) {
- _playbackRate = 1.05;
- } else if (
- currentSongMediaType.value === "youtube" &&
- youtubePlayerReady.value &&
- youtubePlayer.value.getPlaybackRate !== 1.0
- ) {
- youtubePlayer.value.setPlaybackRate(1.0);
- }
- if (
- currentSongMediaType.value === "youtube" &&
- youtubePlayerReady.value &&
- playbackRate.value !== _playbackRate
- ) {
- youtubePlayer.value.setPlaybackRate(_playbackRate);
- playbackRate.value = _playbackRate;
- }
- }
- let localTimePaused = timePaused.value;
- if (stationPaused.value)
- localTimePaused += dateCurrently() - pausedAt.value;
- const duration =
- (dateCurrently() - startedAt.value - localTimePaused) / 1000;
- const songDuration = currentSong.value.duration;
- // TODO: we should really move this out of calculateTimeElapsed in the future
- if (
- youtubePlayerReady.value &&
- songDuration <= duration &&
- currentSongMediaType.value === "youtube"
- )
- playerPause();
- if (duration <= songDuration)
- timeElapsed.value =
- typeof duration === "number" ? utils.formatTime(duration) : "0";
- };
- const playVideo = () => {
- console.debug(TAG, "Play video start");
- if (currentSongMediaType.value === "youtube") {
- if (youtubePlayerReady.value) {
- videoLoading.value = true;
- if (stationPaused.value || localPaused.value) {
- youtubePlayer.value.cueVideoById(
- currentYoutubeId.value,
- getTimeElapsed() / 1000 + currentSong.value.skipDuration
- );
- } else {
- youtubePlayer.value.loadVideoById(
- currentYoutubeId.value,
- getTimeElapsed() / 1000 + currentSong.value.skipDuration
- );
- }
- }
- } else if (currentSongMediaType.value === "soundcloud") {
- const soundcloudId = currentSongMediaValue.value;
- soundcloudLoadTrack(
- soundcloudId,
- getTimeElapsed() / 1000 + currentSong.value.skipDuration,
- localPaused.value || stationPaused.value
- );
- }
- if (window.stationInterval !== 0) clearInterval(window.stationInterval);
- window.stationInterval = window.setInterval(() => {
- if (!stationPaused.value) {
- resizeSeekerbar();
- calculateTimeElapsed();
- }
- }, 150);
- console.debug(TAG, "Play video end");
- };
- const changeSoundcloudPlayerVolume = () => {
- if (muted.value) soundcloudSetVolume(0);
- else soundcloudSetVolume(volumeSliderValue.value);
- };
- const changePlayerVolume = () => {
- if (youtubePlayerReady.value) {
- youtubePlayer.value.setVolume(volumeSliderValue.value);
- if (muted.value) youtubePlayer.value.mute();
- else youtubePlayer.value.unMute();
- }
- changeSoundcloudPlayerVolume();
- };
- const playerPlay = () => {
- if (stationPaused.value || localPaused.value) return;
- console.debug(
- TAG,
- "PLAYER PLAY",
- currentSongMediaType.value,
- youtubePlayerReady.value
- );
- if (currentSongMediaType.value === "youtube" && youtubePlayerReady.value) {
- youtubePlayer.value.playVideo();
- }
- if (currentSongMediaType.value === "soundcloud") {
- soundcloudPlay();
- }
- };
- const playerStop = () => {
- if (youtubePlayerReady.value) {
- youtubePlayer.value.stopVideo();
- }
- soundcloudDestroy();
- };
- const toggleSkipVote = (message?) => {
- socket.dispatch("stations.toggleSkipVote", station.value._id, data => {
- if (data.status !== "success") new Toast(`Error: ${data.message}`);
- else
- new Toast(
- message || "Successfully toggled vote to skip the current song."
- );
- });
- };
- const autoSkipVote = () => {
- if (
- !(localPaused.value || stationPaused.value) &&
- !currentSong.value.voted
- ) {
- // automatically vote to skip
- toggleSkipVote(
- "Automatically voted to skip as this song isn't available for you."
- );
- }
- // persistent message while song is playing
- const persistentToast = new Toast({
- content:
- "This song is unavailable for you, but may be working fine for everyone else.",
- persistent: true
- });
- // save current song id
- const erroredMediaSource = currentSong.value.mediaSource;
- const self = {
- toast: persistentToast,
- checkIfCanRemove: () => {
- if (currentSong.value.mediaSource !== erroredMediaSource) {
- persistentToast.destroy();
- persistentToasts.value.splice(
- persistentToasts.value.indexOf(self),
- 1
- );
- return true;
- }
- return false;
- }
- };
- persistentToasts.value.push(self);
- };
- const resumeLocalPlayer = () => {
- if (experimental.value.media_session)
- updateMediaSessionData(currentSong.value);
- if (!noSong.value) {
- playerSeekTo(getTimeElapsed() / 1000 + currentSong.value.skipDuration);
- playerPlay();
- }
- };
- const resumeLocalStation = () => {
- updateLocalPaused(false);
- if (!stationPaused.value) resumeLocalPlayer();
- };
- const pauseLocalPlayer = () => {
- if (experimental.value.media_session)
- updateMediaSessionData(currentSong.value);
- if (!noSong.value) {
- timeBeforePause.value = getTimeElapsed();
- playerPause();
- }
- };
- const pauseLocalStation = () => {
- updateLocalPaused(true);
- pauseLocalPlayer();
- };
- const youtubeReady = () => {
- if (experimentalChangableListenMode.value === "participate") return;
- if (!youtubePlayer.value) {
- ms.setYTReady(false);
- youtubePlayer.value = new window.YT.Player("youtubeStationPlayer", {
- height: 270,
- width: 480,
- // TODO CHECK TYPE
- videoId: currentYoutubeId.value,
- host: "https://www.youtube-nocookie.com",
- startSeconds:
- getTimeElapsed() / 1000 + currentSong.value.skipDuration,
- playerVars: {
- controls: 0,
- iv_load_policy: 3,
- rel: 0,
- showinfo: 0,
- disablekb: 1,
- playsinline: 1
- },
- events: {
- onReady: () => {
- youtubePlayerReady.value = true;
- ms.setYTReady(true);
- changePlayerVolume();
- playVideo();
- const duration =
- (dateCurrently() - startedAt.value - timePaused.value) /
- 1000;
- const songDuration = currentSong.value.duration;
- if (songDuration <= duration)
- youtubePlayer.value.pauseVideo();
- // on ios, playback will be forcibly paused locally
- if (isApple.value) {
- updateLocalPaused(true);
- new Toast(
- `Please click play manually to use ${sitename.value} on iOS.`
- );
- }
- },
- onError: err => {
- console.log("error with youtube video", err);
- if (err.data >= 100 && loggedIn.value) autoSkipVote();
- else
- new Toast(
- "There has been an error with the YouTube Embed"
- );
- autoPaused.value = true;
- },
- onStateChange: event => {
- switch (event.data) {
- case window.YT.PlayerState.UNSTARTED:
- youtubePlayerState.value = "UNSTARTED";
- break;
- case window.YT.PlayerState.ENDED:
- youtubePlayerState.value = "ENDED";
- break;
- case window.YT.PlayerState.PLAYING:
- youtubePlayerState.value = "PLAYING";
- break;
- case window.YT.PlayerState.PAUSED:
- youtubePlayerState.value = "PAUSED";
- break;
- case window.YT.PlayerState.BUFFERING:
- youtubePlayerState.value = "BUFFERING";
- break;
- case window.YT.PlayerState.CUED:
- youtubePlayerState.value = "CUED";
- break;
- default:
- youtubePlayerState.value = null;
- }
- if (event.data === window.YT.PlayerState.PLAYING)
- autoPaused.value = false;
- if (
- event.data === window.YT.PlayerState.PLAYING &&
- (noSong.value ||
- currentSongMediaType.value !== "youtube")
- ) {
- youtubePlayer.value.stopVideo();
- } else if (
- event.data === window.YT.PlayerState.PLAYING &&
- videoLoading.value === true
- ) {
- videoLoading.value = false;
- youtubePlayer.value.seekTo(
- getTimeElapsed() / 1000 +
- currentSong.value.skipDuration,
- true
- );
- canAutoplay.value = true;
- if (stationPaused.value || localPaused.value)
- youtubePlayer.value.pauseVideo();
- } else if (
- event.data === window.YT.PlayerState.PLAYING &&
- (localPaused.value || stationPaused.value)
- ) {
- youtubePlayer.value.seekTo(
- timeBeforePause.value / 1000,
- true
- );
- if (stationPaused.value)
- youtubePlayer.value.pauseVideo();
- else resumeLocalStation();
- } else if (
- event.data === window.YT.PlayerState.PLAYING &&
- seeking.value === true
- )
- seeking.value = false;
- if (
- event.data === window.YT.PlayerState.PAUSED &&
- !localPaused.value &&
- !stationPaused.value &&
- !noSong.value &&
- currentSongMediaType.value === "youtube" &&
- getTimeRemaining() > 0
- ) {
- youtubePlayer.value.seekTo(
- getTimeElapsed() / 1000 +
- currentSong.value.skipDuration,
- true
- );
- pauseLocalStation();
- }
- }
- }
- });
- }
- };
- const setCurrentSong = data => {
- console.debug(TAG, "Set current song start");
- const {
- currentSong: _currentSong,
- startedAt: _startedAt,
- paused: _paused,
- timePaused: _timePaused,
- pausedAt: _pausedAt
- } = data;
- if (_currentSong) {
- if (!_currentSong.skipDuration || _currentSong.skipDuration < 0)
- _currentSong.skipDuration = 0;
- if (!_currentSong.duration || _currentSong.duration < 0)
- _currentSong.duration = 0;
- }
- updateCurrentSong(_currentSong || {});
- let nextSong = null;
- if (songsList.value[0])
- nextSong = songsList.value[0].mediaSource ? songsList.value[0] : null;
- updateNextSong(nextSong);
- setNextCurrentSong(
- {
- currentSong: null,
- startedAt: 0,
- _paused,
- timePaused: 0,
- pausedAt: 0
- },
- true
- );
- clearTimeout(window.stationNextSongTimeout);
- if (experimental.value.media_session) updateMediaSessionData(_currentSong);
- startedAt.value = _startedAt;
- updateStationPaused(_paused);
- timePaused.value = _timePaused;
- pausedAt.value = _pausedAt;
- playerStop();
- if (_currentSong) {
- updateNoSong(false);
- if (currentSongMediaType.value === "youtube") {
- if (!youtubePlayerReady.value) youtubeReady();
- else playVideo();
- } else if (currentSongMediaType.value === "soundcloud") {
- playVideo();
- }
- // 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
- if (!stationPaused.value && !socket.ready) {
- if (nextSong)
- setNextCurrentSong(
- {
- currentSong: nextSong,
- startedAt: Date.now() + getTimeRemaining(),
- paused: false,
- timePaused: 0
- },
- true
- );
- else
- setNextCurrentSong(
- {
- currentSong: null,
- startedAt: 0,
- paused: false,
- timePaused: 0,
- pausedAt: 0
- },
- true
- );
- window.stationNextSongTimeout = setTimeout(() => {
- if (
- !noSong.value &&
- _currentSong.value._id === _currentSong._id
- )
- skipSong();
- }, getTimeRemaining());
- }
- const currentSongId = currentSong.value._id;
- socket.dispatch(
- "stations.getSkipVotes",
- station.value._id,
- currentSongId,
- res => {
- if (res.status === "success") {
- const { skipVotes, skipVotesCurrent, voted } = res.data;
- if (
- !noSong.value &&
- currentSong.value._id === currentSongId
- ) {
- updateCurrentSongSkipVotes({
- skipVotes,
- skipVotesCurrent,
- voted
- });
- }
- }
- }
- );
- socket.dispatch("media.getRatings", _currentSong.mediaSource, res => {
- if (_currentSong.mediaSource === currentSong.value.mediaSource) {
- const { likes, dislikes } = res.data;
- updateCurrentSongRatings({ likes, dislikes });
- }
- });
- if (loggedIn.value) {
- socket.dispatch(
- "media.getOwnRatings",
- _currentSong.mediaSource,
- res => {
- console.log("getOwnSongRatings", res);
- if (
- res.status === "success" &&
- currentSong.value.mediaSource === res.data.mediaSource
- ) {
- updateOwnCurrentSongRatings(res.data);
- if (
- autoSkipDisliked.value &&
- res.data.disliked === true &&
- !(
- localPaused.value ||
- stationPaused.value ||
- autoPaused.value
- ) &&
- !currentSong.value.voted
- ) {
- toggleSkipVote(
- "Automatically voted to skip disliked song."
- );
- }
- }
- }
- );
- }
- } else {
- updateNoSong(true);
- }
- calculateTimeElapsed();
- resizeSeekerbar();
- console.debug(TAG, "Set current song end");
- };
- const changeVolume = () => {
- const volume = volumeSliderValue.value;
- localStorage.setItem("volume", `${volume}`);
- muted.value = volume <= 0;
- localStorage.setItem("muted", `${muted.value}`);
- changePlayerVolume();
- };
- const skipStation = () => {
- socket.dispatch("stations.forceSkip", station.value._id, data => {
- if (data.status !== "success") new Toast(`Error: ${data.message}`);
- else new Toast("Successfully skipped the station's current song.");
- });
- };
- const resumeStation = () => {
- socket.dispatch("stations.resume", station.value._id, data => {
- if (data.status !== "success") new Toast(`Error: ${data.message}`);
- else new Toast("Successfully resumed the station.");
- });
- };
- const pauseStation = () => {
- socket.dispatch("stations.pause", station.value._id, data => {
- if (data.status !== "success") new Toast(`Error: ${data.message}`);
- else new Toast("Successfully paused the station.");
- });
- };
- const toggleMute = () => {
- muted.value = !muted.value;
- changePlayerVolume();
- };
- const toggleLike = () => {
- if (currentSong.value.liked)
- socket.dispatch("media.unlike", currentSong.value.mediaSource, res => {
- if (res.status !== "success") new Toast(`Error: ${res.message}`);
- });
- else
- socket.dispatch("media.like", currentSong.value.mediaSource, res => {
- if (res.status !== "success") new Toast(`Error: ${res.message}`);
- });
- };
- const toggleDislike = () => {
- if (currentSong.value.disliked)
- return socket.dispatch(
- "media.undislike",
- currentSong.value.mediaSource,
- res => {
- if (res.status !== "success")
- new Toast(`Error: ${res.message}`);
- }
- );
- return socket.dispatch(
- "media.dislike",
- currentSong.value.mediaSource,
- res => {
- if (res.status !== "success") new Toast(`Error: ${res.message}`);
- }
- );
- };
- const togglePlayerDebugBox = () => {
- playerDebugBox.value.toggleBox();
- };
- const resetPlayerDebugBox = () => {
- playerDebugBox.value.resetBox();
- };
- const toggleKeyboardShortcutsHelper = () => {
- keyboardShortcutsHelper.value.toggleBox();
- };
- const resetKeyboardShortcutsHelper = () => {
- keyboardShortcutsHelper.value.resetBox();
- };
- const sendActivityWatchMediaData = () => {
- // TODO have this support soundcloud
- if (
- !autoPaused.value &&
- !stationPaused.value &&
- (!localPaused.value ||
- experimentalChangableListenMode.value === "participate") &&
- !noSong.value &&
- (experimentalChangableListenMode.value === "participate" ||
- currentSongMediaType.value !== "youtube" ||
- (typeof youtubePlayer.value?.getPlayerState === "function" &&
- youtubePlayer.value?.getPlayerState() ===
- window.YT.PlayerState.PLAYING))
- ) {
- if (activityWatchMediaLastStatus.value !== "playing") {
- activityWatchMediaLastStatus.value = "playing";
- activityWatchMediaLastStartDuration.value =
- currentSong.value.skipDuration + getTimeElapsed();
- }
- if (
- activityWatchMediaLastMediaSource.value !==
- currentSong.value.mediaSource
- ) {
- activityWatchMediaLastMediaSource.value =
- currentSong.value.mediaSource;
- activityWatchMediaLastStartDuration.value =
- currentSong.value.skipDuration + getTimeElapsed();
- }
- const videoData = {
- title: currentSong.value ? currentSong.value.title : null,
- artists:
- currentSong.value && currentSong.value.artists
- ? currentSong.value.artists.join(", ")
- : null,
- mediaSource: currentSong.value.mediaSource,
- muted: muted.value,
- volume: volumeSliderValue.value,
- startedDuration:
- activityWatchMediaLastStartDuration.value <= 0
- ? 0
- : Math.floor(
- activityWatchMediaLastStartDuration.value / 1000
- ),
- source: `station#${station.value.name}`,
- hostname: window.location.hostname,
- experimentalChangableListenMode:
- experimentalChangableListenMode.value,
- playerState: "",
- playbackRate: -1
- };
- if (currentSongMediaType.value === "youtube") {
- videoData.playerState =
- experimentalChangableListenMode.value === "participate"
- ? "none"
- : Object.keys(window.YT.PlayerState).find(
- key =>
- window.YT.PlayerState[key] ===
- youtubePlayer.value?.getPlayerState()
- );
- videoData.playbackRate = playbackRate.value;
- } else {
- delete videoData.playerState;
- delete videoData.playbackRate;
- }
- const success = aw.sendMediaData(videoData);
- if (!success) pauseLocalStation();
- } else {
- activityWatchMediaLastStatus.value = "not_playing";
- }
- };
- const experimentalChangableListenModeChange = newMode => {
- experimentalChangableListenMode.value = newMode;
- localStorage.setItem(
- `experimental_changeable_listen_mode_${station.value._id}`,
- newMode
- );
- if (newMode === "participate") {
- // Destroy the YouTube player
- if (youtubePlayer.value) {
- youtubePlayer.value.destroy();
- youtubePlayer.value = null;
- youtubePlayerReady.value = false;
- youtubePlayerState.value = null;
- }
- soundcloudDestroy();
- } else {
- // Recreate the YouTube player
- youtubeReady();
- }
- };
- watch(
- () => autoRequest.value.length,
- () => {
- autoRequestSong();
- }
- );
- onMounted(async () => {
- console.debug(TAG, "On mounted start");
- mediaModalWatcher.value = stationStore.$onAction(({ name, args }) => {
- if (name === "updateMediaModalPlayingAudio") {
- const [mediaModalPlayingAudio] = args;
- if (mediaModalPlayingAudio) {
- if (!beforeMediaModalLocalPausedLock.value) {
- beforeMediaModalLocalPausedLock.value = true;
- beforeMediaModalLocalPaused.value = localPaused.value;
- pauseLocalStation();
- }
- } else {
- beforeMediaModalLocalPausedLock.value = false;
- if (!beforeMediaModalLocalPaused.value) resumeLocalStation();
- }
- }
- });
- document.body.scrollTo(0, 0);
- stationIdentifier.value = route.params.id;
- window.stationInterval = 0;
- activityWatchMediaDataInterval.value = setInterval(() => {
- sendActivityWatchMediaData();
- }, 1000);
- reportStationStateInterval.value = setInterval(() => {
- socket.dispatch(
- "stations.setStationState",
- stationState.value,
- () => {}
- );
- }, 5000);
- persistentToastCheckerInterval.value = setInterval(() => {
- persistentToasts.value.filter(
- persistentToast => !persistentToast.checkIfCanRemove()
- );
- }, 1000);
- socket.onConnect(() => {
- console.debug(TAG, "On socked connect start");
- clearTimeout(window.stationNextSongTimeout);
- socket.dispatch("stations.join", stationIdentifier.value, async res => {
- if (res.status === "success") {
- console.debug(TAG, "Station join start");
- setTimeout(() => {
- loading.value = false;
- }, 1000); // prevents popping in of youtube embed etc.
- const {
- _id,
- displayName,
- name,
- description,
- privacy,
- owner,
- autofill,
- blacklist,
- type,
- isFavorited,
- theme,
- requests,
- djs
- } = res.data;
- if (experimental.value.changable_listen_mode) {
- if (experimental.value.changable_listen_mode === true)
- experimentalChangableListenModeEnabled.value = true;
- else if (
- Array.isArray(
- experimental.value.changable_listen_mode
- ) &&
- experimental.value.changable_listen_mode.indexOf(
- _id
- ) !== -1
- )
- experimentalChangableListenModeEnabled.value = true;
- }
- if (experimentalChangableListenModeEnabled.value) {
- console.log(
- `Experimental changeable listen mode is enabled`
- );
- const experimentalChangeableListenModeLS =
- localStorage.getItem(
- `experimental_changeable_listen_mode_${_id}`
- );
- if (experimentalChangeableListenModeLS)
- experimentalChangableListenMode.value =
- experimentalChangeableListenModeLS;
- }
- // change url to use station name instead of station id
- if (name !== stationIdentifier.value) {
- // eslint-disable-next-line no-restricted-globals
- router.replace(name);
- }
- joinStation({
- _id,
- name,
- displayName,
- description,
- privacy,
- owner,
- autofill,
- blacklist,
- type,
- isFavorited,
- theme,
- requests,
- djs
- });
- document.getElementsByTagName("html")[0].style.cssText =
- `--primary-color: var(--${res.data.theme})`;
- setCurrentSong({
- currentSong: res.data.currentSong,
- startedAt: res.data.startedAt,
- paused: res.data.paused,
- timePaused: res.data.timePaused,
- pausedAt: res.data.pausedAt
- });
- updateUserCount(res.data.userCount);
- updateUsers(res.data.users);
- await updatePermissions();
- socket.dispatch(
- "stations.getStationAutofillPlaylistsById",
- station.value._id,
- res => {
- if (res.status === "success") {
- setAutofillPlaylists(res.data.playlists);
- }
- }
- );
- socket.dispatch(
- "stations.getStationBlacklistById",
- station.value._id,
- res => {
- if (res.status === "success") {
- setBlacklist(res.data.playlists);
- }
- }
- );
- socket.dispatch("stations.getQueue", _id, res => {
- if (res.status === "success") {
- const { queue } = res.data;
- updateSongsList(queue);
- const [nextSong] = queue;
- updateNextSong(nextSong);
- }
- });
- if (experimental.value.station_history)
- socket.dispatch("stations.getHistory", _id, res => {
- if (res.status === "success") {
- const { history } = res.data;
- setHistory(history);
- }
- });
- if (hasPermission("stations.playback.toggle"))
- keyboardShortcuts.registerShortcut("station.pauseResume", {
- keyCode: 32, // Spacebar
- shift: false,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- if (stationPaused.value) resumeStation();
- else pauseStation();
- }
- });
- if (hasPermission("stations.skip"))
- keyboardShortcuts.registerShortcut("station.skipStation", {
- keyCode: 39, // Right arrow key
- shift: false,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- skipStation();
- }
- });
- keyboardShortcuts.registerShortcut("station.lowerVolumeLarge", {
- keyCode: 40, // Down arrow key
- shift: false,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- volumeSliderValue.value -= 10;
- changeVolume();
- }
- });
- keyboardShortcuts.registerShortcut("station.lowerVolumeSmall", {
- keyCode: 40, // Down arrow key
- shift: true,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- volumeSliderValue.value -= 1;
- changeVolume();
- }
- });
- keyboardShortcuts.registerShortcut(
- "station.increaseVolumeLarge",
- {
- keyCode: 38, // Up arrow key
- shift: false,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- volumeSliderValue.value += 10;
- changeVolume();
- }
- }
- );
- keyboardShortcuts.registerShortcut(
- "station.increaseVolumeSmall",
- {
- keyCode: 38, // Up arrow key
- shift: true,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- volumeSliderValue.value += 1;
- changeVolume();
- }
- }
- );
- keyboardShortcuts.registerShortcut("station.toggleDebug", {
- keyCode: 68, // D key
- shift: false,
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- togglePlayerDebugBox();
- }
- });
- keyboardShortcuts.registerShortcut(
- "station.toggleKeyboardShortcutsHelper",
- {
- keyCode: 191, // '/' key
- ctrl: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- toggleKeyboardShortcutsHelper();
- }
- }
- );
- keyboardShortcuts.registerShortcut(
- "station.resetKeyboardShortcutsHelper",
- {
- keyCode: 191, // '/' key
- ctrl: true,
- shift: true,
- preventDefault: true,
- handler: () => {
- if (aModalIsOpen.value) return;
- resetKeyboardShortcutsHelper();
- }
- }
- );
- keyboardShortcuts.registerShortcut(
- "station.recalculateSystemTimeDifference",
- {
- keyCode: 82, // R key
- shift: true,
- alt: true,
- preventDefault: true,
- handler: () => {
- calculateTimeDifference();
- }
- }
- );
- calculateTimeDifference(true);
- console.debug(TAG, "Station join end");
- } else {
- loading.value = false;
- exists.value = false;
- }
- });
- socket.dispatch(
- "stations.existsByName",
- stationIdentifier.value,
- res => {
- if (res.status === "error" || !res.data.exists) {
- // station identifier may be using stationid instead
- socket.dispatch(
- "stations.existsById",
- stationIdentifier.value,
- res => {
- if (res.status === "error" || !res.data.exists) {
- loading.value = false;
- exists.value = false;
- }
- }
- );
- }
- }
- );
- console.debug(TAG, "On socked connect end");
- });
- socket.onDisconnect(() => {
- const _currentSong = currentSong.value;
- if (nextSong.value)
- setNextCurrentSong(
- {
- currentSong: nextSong.value,
- startedAt: Date.now() + getTimeRemaining(),
- paused: false,
- timePaused: 0
- },
- true
- );
- else
- setNextCurrentSong(
- {
- currentSong: null,
- startedAt: 0,
- paused: false,
- timePaused: 0,
- pausedAt: 0
- },
- true
- );
- window.stationNextSongTimeout = setTimeout(() => {
- if (!noSong.value && currentSong.value._id === _currentSong._id)
- skipSong();
- }, getTimeRemaining());
- clearTimeout(calculateTimeDifferenceTimeout.value);
- }, true);
- socket.on("event:station.nextSong", res => {
- const { currentSong, startedAt, paused, timePaused } = res.data;
- setCurrentSong({
- currentSong,
- startedAt,
- paused,
- timePaused,
- pausedAt: 0
- });
- });
- socket.on("event:station.pause", res => {
- pausedAt.value = res.data.pausedAt;
- updateStationPaused(true);
- pauseLocalPlayer();
- clearTimeout(window.stationNextSongTimeout);
- });
- socket.on("event:station.resume", res => {
- timePaused.value = res.data.timePaused;
- updateStationPaused(false);
- if (!localPaused.value) resumeLocalPlayer();
- autoRequestSong();
- });
- socket.on("event:station.deleted", () => {
- router.push({
- path: "/",
- query: {
- toast: "The station you were in was deleted."
- }
- });
- });
- socket.on("event:ratings.liked", res => {
- if (!noSong.value) {
- if (res.data.mediaSource === currentSong.value.mediaSource) {
- updateCurrentSongRatings(res.data);
- }
- }
- });
- socket.on("event:ratings.disliked", res => {
- if (!noSong.value) {
- if (res.data.mediaSource === currentSong.value.mediaSource) {
- updateCurrentSongRatings(res.data);
- }
- }
- });
- socket.on("event:ratings.unliked", res => {
- if (!noSong.value) {
- if (res.data.mediaSource === currentSong.value.mediaSource) {
- updateCurrentSongRatings(res.data);
- }
- }
- });
- socket.on("event:ratings.undisliked", res => {
- if (!noSong.value) {
- if (res.data.mediaSource === currentSong.value.mediaSource) {
- updateCurrentSongRatings(res.data);
- }
- }
- });
- socket.on("event:ratings.updated", res => {
- if (!noSong.value) {
- if (res.data.mediaSource === currentSong.value.mediaSource) {
- updateOwnCurrentSongRatings(res.data);
- }
- }
- });
- socket.on("event:station.queue.updated", res => {
- updateSongsList(res.data.queue);
- let nextSong = null;
- if (songsList.value[0])
- nextSong = songsList.value[0].mediaSource
- ? songsList.value[0]
- : null;
- updateNextSong(nextSong);
- autoRequestSong();
- });
- socket.on("event:station.queue.order.changed", res => {
- reorderSongsList(res.data.queueOrder);
- let nextSong = null;
- if (songsList.value[0])
- nextSong = songsList.value[0].mediaSource
- ? songsList.value[0]
- : null;
- updateNextSong(nextSong);
- });
- socket.on("event:station.toggleSkipVote", res => {
- if (currentSong.value)
- updateCurrentSongSkipVotes({
- skipVotes: res.data.voted
- ? currentSong.value.skipVotes + 1
- : currentSong.value.skipVotes - 1,
- skipVotesCurrent: null,
- voted:
- res.data.userId === userId.value
- ? res.data.voted
- : currentSong.value.voted
- });
- });
- socket.on("event:station.updated", async res => {
- const { name, theme, privacy } = res.data.station;
- if (!hasPermission("stations.view") && privacy === "private") {
- router.push({
- path: "/",
- query: {
- toast: "The station you were in was made private."
- }
- });
- } else {
- if (station.value.name !== name) {
- await router.push(
- `${name}?${Object.keys(route.query)
- .map(
- key =>
- `${encodeURIComponent(
- key
- )}=${encodeURIComponent(
- JSON.stringify(route.query[key])
- )}`
- )
- .join("&")}`
- );
- // eslint-disable-next-line no-restricted-globals
- window.history.replaceState(
- { ...window.history.state, ...{} },
- null
- );
- }
- if (station.value.theme !== theme)
- document.getElementsByTagName("html")[0].style.cssText =
- `--primary-color: var(--${theme})`;
- updateStation(res.data.station);
- }
- });
- socket.on("event:station.users.updated", res =>
- updateUsers(res.data.users)
- );
- socket.on("event:station.userCount.updated", res =>
- updateUserCount(res.data.userCount)
- );
- socket.on("event:user.station.favorited", res => {
- if (res.data.stationId === station.value._id)
- updateIfStationIsFavorited({ isFavorited: true });
- });
- socket.on("event:user.station.unfavorited", res => {
- if (res.data.stationId === station.value._id)
- updateIfStationIsFavorited({ isFavorited: false });
- });
- socket.on("event:station.djs.added", res => {
- if (res.data.user._id === userId.value)
- updatePermissions().then(() => {
- if (
- !hasPermission("stations.view") &&
- station.value.privacy === "private"
- )
- router.push({
- path: "/",
- query: {
- toast: "You no longer have access to the station you were in."
- }
- });
- });
- addDj(res.data.user);
- });
- socket.on("event:station.djs.removed", res => {
- if (res.data.user._id === userId.value)
- updatePermissions().then(() => {
- if (
- !hasPermission("stations.view") &&
- station.value.privacy === "private"
- )
- router.push({
- path: "/",
- query: {
- toast: "You no longer have access to the station you were in."
- }
- });
- });
- removeDj(res.data.user);
- });
- socket.on("event:station.history.new", res => {
- addHistoryItem(res.data.historyItem);
- });
- socket.on("keep.event:user.role.updated", () => {
- updatePermissions().then(() => {
- if (
- !hasPermission("stations.view") &&
- station.value.privacy === "private"
- )
- router.push({
- path: "/",
- query: {
- toast: "You no longer have access to the station you were in."
- }
- });
- });
- });
- frontendDevMode.value = process.env.NODE_ENV;
- ms.setListeners(0, {
- play: () => {
- if (hasPermission("stations.playback.toggle")) resumeStation();
- else resumeLocalStation();
- },
- pause: () => {
- if (hasPermission("stations.playback.toggle")) pauseStation();
- else pauseLocalStation();
- },
- nexttrack: () => {
- if (hasPermission("stations.skip")) skipStation();
- else if (!currentSong.value.voted) toggleSkipVote();
- }
- });
- if (JSON.parse(localStorage.getItem("muted"))) {
- muted.value = true;
- volumeSliderValue.value = 0;
- } else {
- let volume = parseFloat(localStorage.getItem("volume"));
- volume =
- typeof volume === "number" && !Number.isNaN(volume) ? volume : 20;
- localStorage.setItem("volume", `${volume}`);
- volumeSliderValue.value = volume;
- }
- changePlayerVolume();
- soundcloudOnTrackStateChange(newState => {
- console.debug(TAG, `New state: ${newState}`);
- if (
- newState === "attempting_to_play" ||
- newState === "failed_to_play" ||
- newState === "sound_unavailable"
- ) {
- if (currentSongMediaType.value !== "soundcloud") return;
- if (newState === "failed_to_play") {
- new Toast(
- "Failed to start SoundCloud player. Please try to manually start it."
- );
- } else if (newState === "sound_unavailable") {
- if (loggedIn.value) autoSkipVote();
- else
- new Toast(
- "This song is unavailable for you, but is playing for everyone else."
- );
- }
- autoPaused.value = true;
- } else if (newState === "paused") {
- if (currentSongMediaType.value !== "soundcloud") return;
- if (!localPaused.value && !stationPaused.value) {
- pauseLocalStation();
- }
- } else if (newState === "playing") {
- if (currentSongMediaType.value !== "soundcloud") {
- soundcloudDestroy();
- return;
- }
- autoPaused.value = false;
- if (localPaused.value) resumeLocalStation();
- if (stationPaused.value) {
- soundcloudPause();
- }
- soundcloudSeekTo(
- (getTimeElapsed() / 1000 + currentSong.value.skipDuration) *
- 1000
- );
- } else if (newState === "error") {
- new Toast(
- "Failed to start SoundCloud player. Please try to manually start it."
- );
- autoPaused.value = true;
- }
- });
- soundcloudBindListener("seek", () => {
- console.debug(TAG, "Bind on seek");
- if (seeking.value) seeking.value = false;
- });
- soundcloudBindListener("error", value => {
- console.debug(TAG, "Bind on error", value);
- });
- console.debug(TAG, "On mounted end");
- });
- onBeforeUnmount(() => {
- document.getElementsByTagName("html")[0].style.cssText =
- `--primary-color: ${primaryColor.value}`;
- if (experimental.value.media_session) {
- ms.removeListeners(0);
- ms.removeMediaSessionData(0);
- }
- /** Reset Songslist */
- updateSongsList([]);
- const shortcutNames = [
- "station.pauseResume",
- "station.skipStation",
- "station.lowerVolumeLarge",
- "station.lowerVolumeSmall",
- "station.increaseVolumeLarge",
- "station.increaseVolumeSmall",
- "station.toggleDebug",
- "station.recalculateSystemTimeDifference"
- ];
- shortcutNames.forEach(shortcutName => {
- keyboardShortcuts.unregisterShortcut(shortcutName);
- });
- mediaModalWatcher.value(); // removes the watcher
- clearInterval(activityWatchMediaDataInterval.value);
- clearTimeout(window.stationNextSongTimeout);
- clearTimeout(persistentToastCheckerInterval.value);
- clearInterval(reportStationStateInterval.value);
- clearTimeout(calculateTimeDifferenceTimeout.value);
- persistentToasts.value.forEach(persistentToast => {
- persistentToast.toast.destroy();
- });
- socket.dispatch("stations.leave", station.value._id, () => {});
- const { allowAutorequest } = station.value.requests;
- if (
- !autoRequestLock.value &&
- allowAutorequest &&
- autoRequest.value.length > 0
- )
- updateAutorequestLocalStorage();
- leaveStation();
- soundcloudUnload();
- // Delete the Pinia store that was created for this station, after all other cleanup tasks are performed
- stationStore.$dispose();
- });
- </script>
- <template>
- <div>
- <page-metadata
- v-if="exists && !loading"
- :title="`${station.displayName}`"
- />
- <page-metadata v-else-if="!exists && !loading" :title="`Not found`" />
- <div id="page-loader-container" v-if="loading">
- <content-loader
- width="1920"
- height="1080"
- :primary-color="nightmode ? '#222' : '#fff'"
- :secondary-color="nightmode ? '#444' : '#ddd'"
- preserve-aspect-ratio="none"
- id="page-loader-content"
- >
- <rect x="55" y="105" rx="5" ry="5" width="670" height="149" />
- <rect x="55" y="283" rx="5" ry="5" width="670" height="640" />
- <rect x="745" y="108" rx="5" ry="5" width="1120" height="672" />
- <rect x="745" y="810" rx="5" ry="5" width="1120" height="110" />
- </content-loader>
- <content-loader
- width="1920"
- height="1080"
- :primary-color="nightmode ? '#222' : '#fff'"
- :secondary-color="nightmode ? '#444' : '#ddd'"
- preserve-aspect-ratio="none"
- id="page-loader-layout"
- >
- <rect x="0" y="0" rx="0" ry="0" width="1920" height="64" />
- <rect x="0" y="980" rx="0" ry="0" width="1920" height="100" />
- </content-loader>
- </div>
- <!-- More simplistic loading animation for mobile users -->
- <div v-show="loading" id="mobile-progress-animation" />
- <ul
- v-if="
- currentSong &&
- (currentSong.mediaSource === 'l9PxOanFjxQ' ||
- currentSong.mediaSource === 'xKVcVSYmesU' ||
- currentSong.mediaSource === '60ItHLz5WEA' ||
- currentSong.mediaSource === 'e6vkFbtSGm0')
- "
- class="bg-bubbles"
- >
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- <li></li>
- </ul>
- <div v-show="!loading && exists">
- <main-header />
- <div id="station-outer-container">
- <div
- id="station-inner-container"
- :class="{ 'nothing-here': noSong }"
- >
- <div id="station-left-column" class="column">
- <!-- div with quadrant class -->
- <div class="quadrant">
- <station-info-box
- :station="station"
- :station-paused="stationPaused"
- :show-manage-station="true"
- />
- </div>
- <div id="sidebar-container" class="quadrant">
- <station-sidebar />
- </div>
- </div>
- <div id="station-right-column" class="column">
- <div
- class="experimental-listen-mode-container quadrant"
- v-if="
- experimentalChangableListenModeEnabled &&
- !noSong
- "
- v-show="
- experimentalChangableListenMode ===
- 'participate'
- "
- >
- <button
- class="button is-primary"
- @click="
- experimentalChangableListenModeChange(
- 'listen_and_participate'
- )
- "
- >
- <i class="material-icons icon-with-button"
- >music_note</i
- >
- <span>Listen to music</span>
- </button>
- <button
- v-if="!skipVotesLoaded"
- class="button is-primary disabled"
- content="Skip votes have not been loaded yet"
- v-tippy
- >
- <i class="material-icons icon-with-button"
- >skip_next</i
- >
- Vote to skip the current song
- </button>
- <button
- v-else-if="loggedIn"
- :class="[
- 'button',
- 'is-primary',
- { voted: currentSong.voted }
- ]"
- @click="toggleSkipVote()"
- :content="`${
- currentSong.voted ? 'Remove vote' : 'Vote'
- } to Skip Song`"
- v-tippy
- >
- <i class="material-icons icon-with-button"
- >skip_next</i
- >
- Vote to skip the current song -
- {{ currentSong.skipVotes }} votes
- </button>
- <button
- v-else
- class="button is-primary disabled"
- content="Log in to vote to skip songs"
- v-tippy="{ theme: 'info' }"
- >
- <i class="material-icons icon-with-button"
- >skip_next</i
- >
- Vote to skip the current song -
- {{ currentSong.skipVotes }} votes
- </button>
- <div class="row">
- <!-- Ratings -->
- <div
- class="ratings"
- v-if="ratingsLoaded && ownRatingsLoaded"
- :class="{
- liked: currentSong.liked,
- disliked: currentSong.disliked
- }"
- >
- <!-- Like Song Button -->
- <button
- class="button is-success like-song"
- @click="toggleLike()"
- content="Like Song"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- :class="{
- liked: currentSong.liked
- }"
- >thumb_up_alt</i
- >{{ currentSong.likes }}
- </button>
- <!-- Dislike Song Button -->
- <button
- class="button is-danger dislike-song"
- @click="toggleDislike()"
- content="Dislike Song"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- :class="{
- disliked: currentSong.disliked
- }"
- >thumb_down_alt</i
- >{{ currentSong.dislikes }}
- </button>
- </div>
- <div id="ratings" class="disabled" v-else>
- <!-- Like Song Button -->
- <button
- class="button is-success like-song disabled"
- content="Ratings have not been loaded yet"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >thumb_up_alt</i
- >
- </button>
- <!-- Dislike Song Button -->
- <button
- class="button is-danger dislike-song disabled"
- content="Ratings have not been loaded yet"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >thumb_down_alt</i
- >
- </button>
- </div>
- <add-to-playlist-dropdown
- :song="currentSong"
- placement="top-end"
- >
- <template #button>
- <div
- id="add-song-to-playlist"
- content="Add Song to Playlist"
- v-tippy
- >
- <div class="control has-addons">
- <button
- class="button is-primary"
- >
- <i class="material-icons">
- playlist_add
- </i>
- </button>
- <button
- class="button"
- id="dropdown-toggle"
- >
- <i class="material-icons">
- {{
- showPlaylistDropdown
- ? "expand_more"
- : "expand_less"
- }}
- </i>
- </button>
- </div>
- </div>
- </template>
- </add-to-playlist-dropdown>
- </div>
- </div>
- <div
- class="player-container quadrant"
- v-show="
- !noSong &&
- (!experimentalChangableListenModeEnabled ||
- experimentalChangableListenMode ===
- 'listen_and_participate')
- "
- >
- <div id="video-container">
- <div
- v-show="currentSongMediaType === 'youtube'"
- >
- <div
- id="youtubeStationPlayer"
- style="
- width: 100%;
- height: 100%;
- min-height: 200px;
- "
- />
- </div>
- <iframe
- v-if="experimental.soundcloud"
- v-show="
- currentSongMediaType === 'soundcloud'
- "
- id="soundcloudStationPlayer"
- ref="soundcloudIframeElement"
- style="
- width: 100%;
- height: 100%;
- min-height: 200px;
- "
- scrolling="no"
- frameborder="no"
- allow="autoplay"
- ></iframe>
- <div
- class="player-fullscreen-message"
- v-if="stationPaused"
- >
- <p>
- This station is currently paused. <br />
- It can only be resumed by a station
- owner, station DJ or a site
- admin/moderator.
- </p>
- </div>
- <div
- class="player-fullscreen-message"
- v-if="!canAutoplay"
- >
- <p>
- Please click anywhere on the screen for
- the video to start
- </p>
- </div>
- </div>
- <div id="seeker-bar-container">
- <div
- id="seeker-bar"
- :class="{
- 'christmas-seeker': christmas,
- nyan:
- currentSong &&
- currentSong.mediaSource ===
- 'youtube:QH2-TGUlwu4'
- }"
- />
- <div
- class="seeker-bar-cover"
- :style="{
- width: `calc(100% - ${seekerbarPercentage}%)`
- }"
- ></div>
- <img
- v-if="
- currentSong &&
- currentSong.mediaSource ===
- 'youtube:QH2-TGUlwu4'
- "
- src="https://freepngimg.com/thumb/nyan_cat/1-2-nyan-cat-free-download-png.png"
- :style="{
- position: 'absolute',
- top: `-10px`,
- left: `${seekerbarPercentage}%`,
- width: '50px'
- }"
- />
- <img
- v-if="
- currentSong &&
- (currentSong.mediaSource ===
- 'youtube:DtVBCG6ThDk' ||
- currentSong.mediaSource ===
- 'youtube:sI66hcu9fIs' ||
- currentSong.mediaSource ===
- 'youtube:iYYRH4apXDo' ||
- currentSong.mediaSource ===
- 'youtube:tRcPA7Fzebw')
- "
- src="/assets/rocket.svg"
- :style="{
- position: 'absolute',
- top: `-21px`,
- left: `calc(${seekerbarPercentage}% - 35px)`,
- width: '50px',
- transform: 'rotate(45deg)'
- }"
- />
- <img
- v-if="
- currentSong &&
- currentSong.mediaSource ===
- 'youtube:jofNR_WkoCE'
- "
- src="/assets/fox.svg"
- :style="{
- position: 'absolute',
- top: `-21px`,
- left: `calc(${seekerbarPercentage}% - 35px)`,
- width: '50px',
- transform: 'scaleX(-1)',
- opacity: 1
- }"
- />
- <img
- v-if="
- currentSong &&
- (currentSong.mediaSource ===
- 'youtube:l9PxOanFjxQ' ||
- currentSong.mediaSource ===
- 'youtube:xKVcVSYmesU' ||
- currentSong.mediaSource ===
- 'youtube:60ItHLz5WEA' ||
- currentSong.mediaSource ===
- 'youtube:e6vkFbtSGm0')
- "
- src="/assets/old_logo.png"
- :style="{
- position: 'absolute',
- top: `-9px`,
- left: `calc(${seekerbarPercentage}% - 22px)`,
- 'background-color': 'rgb(96, 199, 169)',
- width: '25px',
- height: '25px',
- 'border-radius': '25px'
- }"
- />
- <img
- v-if="
- christmas &&
- currentSong &&
- ![
- 'youtube:QH2-TGUlwu4',
- 'youtube:DtVBCG6ThDk',
- 'youtube:sI66hcu9fIs',
- 'youtube:iYYRH4apXDo',
- 'youtube:tRcPA7Fzebw',
- 'youtube:jofNR_WkoCE',
- 'youtube:l9PxOanFjxQ',
- 'youtube:xKVcVSYmesU',
- 'youtube:60ItHLz5WEA',
- 'youtube:e6vkFbtSGm0'
- ].includes(currentSong.mediaSource)
- "
- src="/assets/santa.png"
- :style="{
- position: 'absolute',
- top: `-30px`,
- left: `calc(${seekerbarPercentage}% - 25px)`,
- height: '50px',
- transform: 'scaleX(-1)'
- }"
- />
- </div>
- <div id="control-bar-container">
- <div id="left-buttons">
- <!-- Debug Box -->
- <button
- v-if="frontendDevMode === 'development'"
- class="button is-primary"
- @click="togglePlayerDebugBox()"
- @dblclick="resetPlayerDebugBox()"
- content="Debug"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >
- bug_report
- </i>
- </button>
- <!-- Local Pause/Resume Button -->
- <button
- class="button is-primary"
- @click="resumeLocalStation()"
- id="local-resume"
- v-if="localPaused || autoPaused"
- content="Unpause Playback"
- v-tippy
- >
- <i class="material-icons">play_arrow</i>
- </button>
- <button
- class="button is-primary"
- @click="pauseLocalStation()"
- id="local-pause"
- v-else
- content="Pause Playback"
- v-tippy
- >
- <i class="material-icons">pause</i>
- </button>
- <!-- Vote to Skip Button -->
- <button
- v-if="!skipVotesLoaded"
- class="button is-primary disabled"
- content="Skip votes have not been loaded yet"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >skip_next</i
- >
- </button>
- <button
- v-else-if="loggedIn"
- :class="[
- 'button',
- 'is-primary',
- { voted: currentSong.voted }
- ]"
- @click="toggleSkipVote()"
- :content="`${
- currentSong.voted
- ? 'Remove vote'
- : 'Vote'
- } to Skip Song`"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >skip_next</i
- >
- {{ currentSong.skipVotes }}
- </button>
- <button
- v-else
- class="button is-primary disabled"
- content="Log in to vote to skip songs"
- v-tippy="{ theme: 'info' }"
- >
- <i
- class="material-icons icon-with-button"
- >skip_next</i
- >
- {{ currentSong.skipVotes }}
- </button>
- <!-- Close player window -->
- <button
- v-if="
- experimentalChangableListenModeEnabled
- "
- class="button is-primary"
- content="Close this player window"
- @click="
- experimentalChangableListenModeChange(
- 'participate'
- )
- "
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >cancel_presentation</i
- >
- </button>
- </div>
- <div id="duration">
- <p>
- {{ timeElapsed }} /
- {{
- utils.formatTime(
- currentSong.duration
- )
- }}
- </p>
- </div>
- <p id="volume-control" v-if="!isApple">
- <i
- class="material-icons"
- @click="toggleMute()"
- :content="`${
- muted ? 'Unmute' : 'Mute'
- }`"
- v-tippy
- >{{
- muted
- ? "volume_mute"
- : volumeSliderValue >= 50
- ? "volume_up"
- : "volume_down"
- }}</i
- >
- <input
- v-model="volumeSliderValue"
- type="range"
- min="0"
- max="100"
- class="volume-slider active"
- @change="changeVolume()"
- @input="changeVolume()"
- />
- </p>
- <div id="right-buttons" v-if="loggedIn">
- <!-- Ratings (Like/Dislike) Buttons -->
- <div
- id="ratings"
- v-if="ratingsLoaded && ownRatingsLoaded"
- :class="{
- liked: currentSong.liked,
- disliked: currentSong.disliked
- }"
- >
- <!-- Like Song Button -->
- <button
- class="button is-success like-song"
- id="like-song"
- @click="toggleLike()"
- content="Like Song"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- :class="{
- liked: currentSong.liked
- }"
- >thumb_up_alt</i
- >{{ currentSong.likes }}
- </button>
- <!-- Dislike Song Button -->
- <button
- class="button is-danger dislike-song"
- id="dislike-song"
- @click="toggleDislike()"
- content="Dislike Song"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- :class="{
- disliked:
- currentSong.disliked
- }"
- >thumb_down_alt</i
- >{{ currentSong.dislikes }}
- </button>
- </div>
- <div id="ratings" class="disabled" v-else>
- <!-- Like Song Button -->
- <button
- class="button is-success like-song disabled"
- id="like-song"
- content="Ratings have not been loaded yet"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >thumb_up_alt</i
- >
- </button>
- <!-- Dislike Song Button -->
- <button
- class="button is-danger dislike-song disabled"
- id="dislike-song"
- content="Ratings have not been loaded yet"
- v-tippy
- >
- <i
- class="material-icons icon-with-button"
- >thumb_down_alt</i
- >
- </button>
- </div>
- <!-- Add Song To Playlist Button & Dropdown -->
- <add-to-playlist-dropdown
- :song="currentSong"
- placement="top-end"
- >
- <template #button>
- <div
- id="add-song-to-playlist"
- content="Add Song to Playlist"
- v-tippy
- >
- <div class="control has-addons">
- <button
- class="button is-primary"
- >
- <i
- class="material-icons"
- >
- playlist_add
- </i>
- </button>
- <button
- class="button"
- id="dropdown-toggle"
- >
- <i
- class="material-icons"
- >
- {{
- showPlaylistDropdown
- ? "expand_more"
- : "expand_less"
- }}
- </i>
- </button>
- </div>
- </div>
- </template>
- </add-to-playlist-dropdown>
- </div>
- <div id="right-buttons" v-else>
- <!-- Disabled Ratings (Like/Dislike) Buttons -->
- <div id="ratings" v-if="ratingsLoaded">
- <!-- Disabled Like Song Button -->
- <button
- class="button is-success disabled"
- id="like-song"
- content="Log in to like songs"
- v-tippy="{ theme: 'info' }"
- >
- <i
- class="material-icons icon-with-button"
- >thumb_up_alt</i
- >{{ currentSong.likes }}
- </button>
- <!-- Disabled Dislike Song Button -->
- <button
- class="button is-danger disabled"
- id="dislike-song"
- content="Log in to dislike songs"
- v-tippy="{ theme: 'info' }"
- >
- <i
- class="material-icons icon-with-button"
- >thumb_down_alt</i
- >{{ currentSong.dislikes }}
- </button>
- </div>
- <div id="ratings" v-else>
- <!-- Disabled Like Song Button -->
- <button
- class="button is-success disabled"
- id="like-song"
- content="Ratings have not been loaded yet"
- v-tippy="{ theme: 'info' }"
- >
- <i
- class="material-icons icon-with-button"
- >thumb_up_alt</i
- >
- </button>
- <!-- Disabled Dislike Song Button -->
- <button
- class="button is-danger disabled"
- id="dislike-song"
- content="Ratings have not been loaded yet"
- v-tippy="{ theme: 'info' }"
- >
- <i
- class="material-icons icon-with-button"
- >thumb_down_alt</i
- >
- </button>
- </div>
- <!-- Disabled Add Song To Playlist Button & Dropdown -->
- <div id="add-song-to-playlist">
- <div class="control has-addons">
- <button
- class="button is-primary disabled"
- content="Log in to add songs to playlist"
- v-tippy="{ theme: 'info' }"
- >
- <i class="material-icons"
- >queue</i
- >
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <p
- class="player-container nothing-here-text"
- v-if="noSong"
- >
- No song is currently playing
- </p>
- <div v-if="!noSong" id="current-next-row">
- <div
- id="currently-playing-container"
- class="quadrant"
- :class="{ 'no-currently-playing': noSong }"
- >
- <media-item
- :key="`songItem-currentSong-${currentSong.mediaSource}`"
- :song="currentSong"
- :duration="false"
- :requested-by="true"
- :requested-type="true"
- header="Currently Playing.."
- />
- </div>
- <div
- v-if="nextSong"
- id="next-up-container"
- class="quadrant"
- >
- <media-item
- :key="`songItem-nextSong-${nextSong.mediaSource}`"
- :song="nextSong"
- :duration="false"
- :requested-by="true"
- :requested-type="true"
- header="Next Up.."
- />
- </div>
- </div>
- </div>
- </div>
- </div>
- <main-footer />
- </div>
- <floating-box
- id="player-debug-box"
- ref="playerDebugBox"
- title="Station Debug"
- >
- <template #body>
- <span><b>No song</b>: {{ noSong }}</span>
- <span><b>Song id</b>: {{ currentSong._id }}</span>
- <span><b>Media source</b>: {{ currentSong.mediaSource }}</span>
- <span
- ><b>Media source type</b>: {{ currentSongMediaType }}</span
- >
- <span
- ><b>Media source value</b>:
- {{ currentSongMediaValue }}</span
- >
- <span><b>Duration</b>: {{ currentSong.duration }}</span>
- <span
- ><b>Skip duration</b>: {{ currentSong.skipDuration }}</span
- >
- <span><b>Loading</b>: {{ loading }}</span>
- <span><b>Can autoplay</b>: {{ canAutoplay }}</span>
- <span
- ><b>Youtube player ready</b>: {{ youtubePlayerReady }}</span
- >
- <span
- ><b>Attempts to play video</b>:
- {{ attemptsToPlayVideo }}</span
- >
- <span
- ><b>Last time requested if can autoplay</b>:
- {{ lastTimeRequestedIfCanAutoplay }}</span
- >
- <span><b>Seeking</b>: {{ seeking }}</span>
- <span><b>Playback rate</b>: {{ playbackRate }}</span>
- <span><b>System difference</b>: {{ systemDifference }}</span>
- <span><b>Time before paused</b>: {{ timeBeforePause }}</span>
- <span><b>Time paused</b>: {{ timePaused }}</span>
- <span><b>Time elapsed</b>: {{ timeElapsed }}</span>
- <span><b>Volume slider value</b>: {{ volumeSliderValue }}</span>
- <span><b>Local paused</b>: {{ localPaused }}</span>
- <span><b>Auto paused</b>: {{ autoPaused }}</span>
- <span><b>Station paused</b>: {{ stationPaused }}</span>
- <span :title="new Date(pausedAt).toString()"
- ><b>Paused at</b>: {{ pausedAt }}</span
- >
- <span :title="new Date(startedAt).toString()"
- ><b>Started at</b>: {{ startedAt }}</span
- >
- <span
- ><b>Requests enabled</b>:
- {{ station.requests.enabled }}</span
- >
- <span
- ><b>Requests access</b>: {{ station.requests.access }}</span
- >
- <span><b>Requests limit</b>: {{ station.requests.limit }}</span>
- <span
- ><b>Auto requesting playlists</b>:
- {{
- autoRequest.map(playlist => playlist._id).join(", ")
- }}</span
- >
- <span
- ><b>Autofill enabled</b>:
- {{ station.autofill.enabled }}</span
- >
- <span><b>Autofill limit</b>: {{ station.autofill.limit }}</span>
- <span><b>Autofill mode</b>: {{ station.autofill.mode }}</span>
- <span><b>Skip votes loaded</b>: {{ skipVotesLoaded }}</span>
- <span
- ><b>Skip votes current</b>:
- {{
- currentSong.skipVotesCurrent
- ? currentSong.skipVotesCurrent
- : "N/A"
- }}</span
- >
- <span
- ><b>Skip votes</b>:
- {{ skipVotesLoaded ? currentSong.skipVotes : "N/A" }}</span
- >
- <span><b>Ratings loaded</b>: {{ ratingsLoaded }}</span>
- <span
- ><b>Ratings</b>:
- {{
- ratingsLoaded
- ? `${currentSong.likes} / ${currentSong.dislikes}`
- : "N/A"
- }}</span
- >
- <span><b>Own ratings loaded</b>: {{ ownRatingsLoaded }}</span>
- <span
- ><b>Own ratings</b>:
- {{
- ownRatingsLoaded
- ? `${currentSong.liked} / ${currentSong.disliked}`
- : "N/A"
- }}</span
- >
- </template>
- </floating-box>
- <floating-box
- id="keyboardShortcutsHelper"
- ref="keyboardShortcutsHelper"
- title="Station Keyboard Shortcuts"
- >
- <template #body>
- <div>
- <div
- v-if="
- hasPermission('stations.playback.toggle') ||
- hasPermission('stations.skip')
- "
- >
- <span class="biggest"><b>Owner/DJ</b></span>
- <span><b>Ctrl + Space</b> - Pause/resume station</span>
- <span><b>Ctrl + Numpad right</b> - Skip station</span>
- </div>
- <hr
- v-if="
- hasPermission('stations.playback.toggle') ||
- hasPermission('stations.skip')
- "
- />
- <div>
- <span class="biggest"><b>Volume</b></span>
- <span
- ><b>Ctrl + Numpad up/down</b> - Volume up/down
- 10%</span
- >
- <span
- ><b>Ctrl + Shift + Numpad up/down</b> - Volume
- up/down 10%</span
- >
- </div>
- <hr />
- <div>
- <span class="biggest"><b>Misc</b></span>
- <span
- ><b>Shift + Alt + R</b> - Recalculates the system
- time difference</span
- >
- <span><b>Ctrl + D</b> - Toggles debug box</span>
- <span><b>Ctrl + Shift + D</b> - Resets debug box</span>
- <span
- ><b>Ctrl + /</b> - Toggles keyboard shortcuts
- box</span
- >
- <span
- ><b>Ctrl + Shift + /</b> - Resets keyboard shortcuts
- box</span
- >
- </div>
- </div>
- </template>
- </floating-box>
- <Z404 v-if="!exists"></Z404>
- </div>
- </template>
- <style lang="less">
- #youtubeStationPlayer,
- #soundcloudStationPlayer {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
- #currently-playing-container,
- #next-up-container {
- .song-item {
- height: 130px !important;
- .thumbnail-and-info .thumbnail {
- min-width: 130px;
- width: 130px;
- }
- }
- }
- #control-bar-container
- #right-buttons
- .tippy-box[data-theme~="dropdown"]
- .nav-dropdown-items {
- padding-bottom: 0 !important;
- }
- </style>
- <style lang="less" scoped>
- #page-loader-container {
- height: inherit;
- #page-loader-content {
- height: inherit;
- position: absolute;
- max-width: 100%;
- width: 1800px;
- transform: translateX(-50%);
- left: 50%;
- }
- #page-loader-layout {
- height: inherit;
- width: 100%;
- }
- }
- #mobile-progress-animation {
- width: 50px;
- animation: rotate 0.8s infinite linear;
- border: 8px solid var(--primary-color);
- border-right-color: transparent;
- border-radius: 50%;
- height: 50px;
- position: absolute;
- top: 50%;
- left: 50%;
- display: none;
- }
- @keyframes rotate {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(360deg);
- }
- }
- #keyboardShortcutsHelper {
- .box-body {
- .biggest {
- font-size: 1.4rem;
- }
- > div,
- > div > div {
- display: flex;
- flex-direction: column;
- }
- > div {
- row-gap: 8px;
- }
- }
- }
- .nav,
- .button.is-primary {
- background-color: var(--primary-color) !important;
- }
- .button.is-primary:hover,
- .button.is-primary:focus {
- filter: brightness(90%);
- }
- .night-mode {
- #currently-playing-container,
- #next-up-container,
- #control-bar-container,
- .quadrant:not(#sidebar-container),
- .player-container {
- background-color: var(--dark-grey-3) !important;
- }
- #video-container,
- #control-bar-container,
- .quadrant:not(#sidebar-container),
- .player-container {
- border: 0 !important;
- }
- #seeker-bar-container {
- background-color: var(--dark-grey-3) !important;
- }
- #dropdown-toggle {
- background-color: var(--dark-grey-2) !important;
- border: 0;
- i {
- color: var(--white);
- }
- }
- }
- #station-outer-container {
- margin: 0 auto;
- padding: 20px 40px;
- min-height: calc(100vh - 64px);
- width: 100%;
- max-width: 1800px;
- display: flex;
- #station-inner-container {
- width: 100%;
- min-height: calc(100vh - 428px);
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- .row {
- display: flex;
- flex-direction: row;
- max-width: 100%;
- }
- .column {
- display: flex;
- flex-direction: column;
- }
- .quadrant {
- border-radius: @border-radius;
- margin: 10px;
- overflow: hidden;
- }
- .quadrant:not(#sidebar-container) {
- background-color: var(--white);
- border: 1px solid var(--light-grey-3);
- }
- #station-left-column,
- #station-right-column {
- padding: 0;
- }
- #current-next-row {
- display: flex;
- flex-direction: row;
- #currently-playing-container,
- #next-up-container {
- overflow: hidden;
- flex-basis: 50%;
- .song-item {
- border: unset;
- }
- .nothing-here-text {
- height: 100%;
- }
- }
- > div:only-child {
- flex: 1 !important;
- flex-basis: 100% !important;
- }
- }
- .player-container {
- height: inherit;
- background-color: var(--white);
- display: flex;
- flex-direction: column;
- border: 1px solid var(--light-grey-3);
- border-radius: @border-radius;
- overflow: hidden;
- &.nothing-here-text {
- margin: 10px;
- flex: 1;
- min-height: 487px;
- }
- #video-container {
- position: relative;
- aspect-ratio: 16/9;
- overflow: hidden;
- .player-fullscreen-message {
- position: relative;
- width: 100%;
- height: 100%;
- background: var(--primary-color);
- display: flex;
- align-items: center;
- justify-content: center;
- p {
- color: var(--white);
- font-size: 26px;
- text-align: center;
- }
- }
- }
- #seeker-bar-container {
- background-color: var(--white);
- position: relative;
- height: 7px;
- display: block;
- width: 100%;
- #seeker-bar {
- background-color: var(--primary-color);
- top: 0;
- left: 0;
- bottom: 0;
- position: absolute;
- width: 100%;
- }
- .seeker-bar-cover {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- background-color: inherit;
- }
- }
- #control-bar-container {
- display: flex;
- justify-content: space-around;
- padding: 10px 0;
- width: 100%;
- background: var(--white);
- flex-direction: column;
- flex-flow: wrap;
- .button:not(#dropdown-toggle) {
- width: 75px;
- }
- #left-buttons,
- #right-buttons {
- margin: 3px;
- }
- #left-buttons {
- display: flex;
- .button:not(:first-of-type) {
- margin-left: 5px;
- }
- .disabled {
- filter: grayscale(0.4);
- }
- }
- #duration {
- margin: 3px;
- display: flex;
- align-items: center;
- p {
- font-size: 22px;
- /** prevents duration width slightly varying and shifting other controls slightly */
- width: 150px;
- text-align: center;
- }
- }
- #volume-control {
- margin: 3px;
- margin-top: 0;
- display: flex;
- align-items: center;
- cursor: pointer;
- .volume-slider {
- width: 100%;
- padding: 0 15px;
- background: transparent;
- min-width: 100px;
- }
- input[type="range"] {
- -webkit-appearance: none;
- appearance: none;
- margin: 7.3px 0;
- }
- input[type="range"]:focus {
- outline: none;
- }
- input[type="range"]::-webkit-slider-runnable-track {
- width: 100%;
- height: 5.2px;
- cursor: pointer;
- box-shadow: 0;
- background: var(--light-grey-3);
- border-radius: @border-radius;
- border: 0;
- }
- input[type="range"]::-webkit-slider-thumb {
- box-shadow: 0;
- border: 0;
- height: 19px;
- width: 19px;
- border-radius: 100%;
- background: var(--primary-color);
- cursor: pointer;
- -webkit-appearance: none;
- appearance: none;
- margin-top: -6.5px;
- }
- input[type="range"]::-moz-range-track {
- width: 100%;
- height: 5.2px;
- cursor: pointer;
- box-shadow: 0;
- background: var(--light-grey-3);
- border-radius: @border-radius;
- border: 0;
- }
- input[type="range"]::-moz-range-thumb {
- box-shadow: 0;
- border: 0;
- height: 19px;
- width: 19px;
- border-radius: 100%;
- background: var(--primary-color);
- cursor: pointer;
- -webkit-appearance: none;
- appearance: none;
- margin-top: -6.5px;
- }
- input[type="range"]::-ms-track {
- width: 100%;
- height: 5.2px;
- cursor: pointer;
- box-shadow: 0;
- background: var(--light-grey-3);
- border-radius: @border-radius;
- }
- input[type="range"]::-ms-fill-lower {
- background: var(--light-grey-3);
- border: 0;
- border-radius: 0;
- box-shadow: 0;
- }
- input[type="range"]::-ms-fill-upper {
- background: var(--light-grey-3);
- border: 0;
- border-radius: 0;
- box-shadow: 0;
- }
- input[type="range"]::-ms-thumb {
- box-shadow: 0;
- border: 0;
- height: 15px;
- width: 15px;
- border-radius: 100%;
- background: var(--primary-color);
- cursor: pointer;
- -webkit-appearance: none;
- appearance: none;
- margin-top: 1.5px;
- }
- }
- #right-buttons {
- display: flex;
- #dropdown-toggle {
- width: 35px;
- }
- #dislike-song,
- #add-song-to-playlist .button:not(#dropdown-toggle) {
- margin-left: 5px;
- }
- #ratings {
- display: flex;
- &.liked #dislike-song,
- &.disliked #like-song {
- background-color: var(--grey) !important;
- }
- #like-song.disabled,
- #dislike-song.disabled {
- filter: grayscale(0.4);
- }
- }
- #add-song-to-playlist {
- display: flex;
- flex-direction: column-reverse;
- #nav-dropdown {
- position: absolute;
- margin-left: 4px;
- margin-bottom: 36px;
- .nav-dropdown-items {
- position: relative;
- right: calc(100% - 110px);
- }
- }
- .control {
- width: fit-content;
- margin-bottom: 0 !important;
- button.disabled {
- filter: grayscale(0.4);
- border-radius: @border-radius;
- &::after {
- margin-right: 100%;
- }
- }
- }
- }
- }
- }
- }
- #sidebar-container {
- border-top: 0;
- position: relative;
- height: inherit;
- flex-grow: 1;
- min-height: 350px;
- }
- }
- }
- .footer {
- margin-top: 30px;
- }
- .nyan {
- background: linear-gradient(
- 90deg,
- magenta 0%,
- red 15%,
- orange 30%,
- yellow 45%,
- lime 60%,
- cyan 75%,
- blue 90%,
- magenta 100%
- );
- background-size: 200%;
- animation: nyanMoving 4s linear infinite;
- }
- @keyframes nyanMoving {
- 0% {
- background-position: 0% 0%;
- }
- 100% {
- background-position: -200% 0%;
- }
- }
- .christmas-seeker {
- background: repeating-linear-gradient(
- -45deg,
- var(--white) 0 1rem,
- var(--dark-red) 1rem 2rem
- );
- background-size: 200% 100%;
- animation: christmas 20s linear infinite;
- }
- @keyframes christmas {
- 100% {
- background-position: 80% 100%;
- }
- }
- .bg-bubbles {
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- position: absolute;
- z-index: -1;
- margin: 0px;
- pointer-events: none;
- }
- .bg-bubbles li {
- position: absolute;
- list-style: none;
- display: block;
- width: 40px;
- height: 40px;
- border-radius: 100px;
- background-color: var(--primary-color);
- opacity: 0.15;
- bottom: 0px;
- -webkit-animation: square 25s infinite;
- animation: square 25s infinite;
- -webkit-transition-timing-function: linear;
- transition-timing-function: linear;
- }
- .bg-bubbles li:nth-child(1) {
- left: 10%;
- }
- .bg-bubbles li:nth-child(2) {
- left: 20%;
- width: 80px;
- height: 80px;
- -webkit-animation-delay: 2s;
- animation-delay: 2s;
- -webkit-animation-duration: 17s;
- animation-duration: 17s;
- }
- .bg-bubbles li:nth-child(3) {
- left: 25%;
- -webkit-animation-delay: 4s;
- animation-delay: 4s;
- }
- .bg-bubbles li:nth-child(4) {
- left: 40%;
- width: 60px;
- height: 60px;
- -webkit-animation-duration: 22s;
- animation-duration: 22s;
- background-color: var(--primary-color);
- opacity: 0.25;
- }
- .bg-bubbles li:nth-child(5) {
- left: 70%;
- }
- .bg-bubbles li:nth-child(6) {
- left: 80%;
- width: 120px;
- height: 120px;
- -webkit-animation-delay: 3s;
- animation-delay: 3s;
- background-color: var(--primary-color);
- opacity: 0.2;
- }
- .bg-bubbles li:nth-child(7) {
- left: 32%;
- width: 160px;
- height: 160px;
- -webkit-animation-delay: 7s;
- animation-delay: 7s;
- }
- .bg-bubbles li:nth-child(8) {
- left: 55%;
- width: 20px;
- height: 20px;
- -webkit-animation-delay: 15s;
- animation-delay: 15s;
- -webkit-animation-duration: 40s;
- animation-duration: 40s;
- }
- .bg-bubbles li:nth-child(9) {
- left: 25%;
- width: 10px;
- height: 10px;
- -webkit-animation-delay: 2s;
- animation-delay: 2s;
- -webkit-animation-duration: 40s;
- animation-duration: 40s;
- background-color: var(--primary-color);
- opacity: 0.3;
- }
- .bg-bubbles li:nth-child(10) {
- left: 80%;
- width: 160px;
- height: 160px;
- -webkit-animation-delay: 11s;
- animation-delay: 11s;
- }
- .experimental-listen-mode-container {
- display: flex;
- flex-direction: column;
- justify-content: center;
- row-gap: 16px;
- padding: 16px 16px;
- .row {
- display: flex;
- flex-direction: row;
- column-gap: 16px;
- .ratings {
- flex: 2;
- display: flex;
- flex-direction: row;
- column-gap: 16px;
- button {
- flex: 1;
- }
- }
- .addToPlaylistDropdown {
- flex: 1;
- .button.is-primary {
- flex: 1;
- }
- }
- }
- }
- /* Tablet view fix */
- @media (max-width: 768px) {
- .bg-bubbles li:nth-child(10) {
- display: none;
- }
- .experimental-listen-mode-container {
- row-gap: 8px;
- .row {
- column-gap: 8px;
- .ratings {
- column-gap: 8px;
- }
- }
- }
- }
- @-webkit-keyframes square {
- 0% {
- -webkit-transform: translateY(0);
- transform: translateY(0);
- }
- 100% {
- -webkit-transform: translateY(-700px) rotate(600deg);
- transform: translateY(-700px) rotate(600deg);
- }
- }
- @keyframes square {
- 0% {
- -webkit-transform: translateY(0);
- transform: translateY(0);
- }
- 100% {
- -webkit-transform: translateY(-700px) rotate(600deg);
- transform: translateY(-700px) rotate(600deg);
- }
- }
- :deep(.nothing-here-text) {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- @media (min-width: 1500px) {
- #station-left-column {
- max-width: 650px;
- }
- #station-right-column {
- max-width: calc(100% - 650px);
- }
- }
- @media (max-width: 1700px) {
- #current-next-row {
- flex-direction: column !important;
- > div {
- flex: 1 !important;
- }
- }
- }
- @media (max-width: 1500px) {
- #mobile-progress-animation {
- display: block;
- }
- #page-loader-container {
- display: none;
- }
- #station-outer-container {
- max-width: 1500px;
- #station-inner-container {
- flex-direction: row;
- #station-left-column {
- #about-station-container #admin-buttons {
- flex-wrap: wrap;
- }
- #sidebar-container {
- min-height: 350px;
- }
- }
- #station-right-column {
- overflow: hidden;
- #current-next-row {
- flex-direction: column;
- }
- #control-bar-container {
- #duration,
- #volume-control,
- #right-buttons,
- #left-buttons {
- margin-bottom: 5px;
- justify-content: center;
- }
- #duration {
- order: 1;
- }
- #volume-control {
- order: 2;
- max-width: 400px;
- }
- #right-buttons {
- order: 3;
- flex-wrap: wrap;
- #ratings {
- flex-wrap: wrap;
- }
- }
- #left-buttons {
- order: 4;
- flex-wrap: wrap;
- }
- }
- }
- }
- }
- }
- @media (max-width: 1200px) {
- #station-outer-container {
- max-width: 900px;
- padding: 0;
- #station-inner-container {
- flex-direction: column-reverse;
- flex-wrap: nowrap;
- #station-right-column {
- overflow: initial;
- }
- }
- }
- }
- @media (max-width: 990px) {
- #station-outer-container {
- min-height: calc(
- 100vh - 256px
- ); // Height of nav (64px) + height of footer (190px)
- }
- }
- </style>
|