index.vue 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066
  1. <template>
  2. <div>
  3. <page-metadata
  4. v-if="exists && !loading"
  5. :title="`${station.displayName}`"
  6. />
  7. <page-metadata v-else-if="!exists && !loading" :title="`Not found`" />
  8. <div id="page-loader-container" v-if="loading">
  9. <content-loader
  10. width="1920"
  11. height="1080"
  12. :primary-color="nightmode ? '#222' : '#fff'"
  13. :secondary-color="nightmode ? '#444' : '#ddd'"
  14. preserve-aspect-ratio="none"
  15. id="page-loader-content"
  16. >
  17. <rect x="55" y="105" rx="5" ry="5" width="670" height="149" />
  18. <rect x="55" y="283" rx="5" ry="5" width="670" height="640" />
  19. <rect x="745" y="108" rx="5" ry="5" width="1120" height="672" />
  20. <rect x="745" y="810" rx="5" ry="5" width="1120" height="110" />
  21. </content-loader>
  22. <content-loader
  23. width="1920"
  24. height="1080"
  25. :primary-color="nightmode ? '#222' : '#fff'"
  26. :secondary-color="nightmode ? '#444' : '#ddd'"
  27. preserve-aspect-ratio="none"
  28. id="page-loader-layout"
  29. >
  30. <rect x="0" y="0" rx="0" ry="0" width="1920" height="64" />
  31. <rect x="0" y="980" rx="0" ry="0" width="1920" height="100" />
  32. </content-loader>
  33. </div>
  34. <!-- More simplistic loading animation for mobile users -->
  35. <div v-show="loading" id="mobile-progress-animation" />
  36. <ul
  37. v-if="
  38. currentSong &&
  39. (currentSong.youtubeId === 'l9PxOanFjxQ' ||
  40. currentSong.youtubeId === 'xKVcVSYmesU' ||
  41. currentSong.youtubeId === '60ItHLz5WEA' ||
  42. currentSong.youtubeId === 'e6vkFbtSGm0')
  43. "
  44. class="bg-bubbles"
  45. >
  46. <li></li>
  47. <li></li>
  48. <li></li>
  49. <li></li>
  50. <li></li>
  51. <li></li>
  52. <li></li>
  53. <li></li>
  54. <li></li>
  55. <li></li>
  56. </ul>
  57. <div v-show="!loading && exists">
  58. <main-header />
  59. <div id="station-outer-container">
  60. <div
  61. id="station-inner-container"
  62. :class="{ 'nothing-here': noSong }"
  63. >
  64. <div id="station-left-column" class="column">
  65. <div id="about-station-container" class="quadrant">
  66. <div id="station-info">
  67. <div class="row" id="station-name">
  68. <h1>{{ station.displayName }}</h1>
  69. <i
  70. v-if="station.type === 'official'"
  71. class="material-icons verified-station"
  72. content="Verified Station"
  73. v-tippy
  74. >
  75. check_circle
  76. </i>
  77. <a>
  78. <!-- Favorite Station Button -->
  79. <i
  80. v-if="
  81. loggedIn && station.isFavorited
  82. "
  83. @click.prevent="unfavoriteStation()"
  84. content="Unfavorite Station"
  85. v-tippy
  86. class="material-icons"
  87. >star</i
  88. >
  89. <i
  90. v-if="
  91. loggedIn && !station.isFavorited
  92. "
  93. @click.prevent="favoriteStation()"
  94. class="material-icons"
  95. content="Favorite Station"
  96. v-tippy
  97. >star_border</i
  98. >
  99. </a>
  100. <i
  101. class="material-icons stationMode"
  102. :content="
  103. station.partyMode
  104. ? 'Station in Party mode'
  105. : 'Station in Playlist mode'
  106. "
  107. v-tippy="{ theme: 'info' }"
  108. >{{
  109. station.partyMode
  110. ? "emoji_people"
  111. : "playlist_play"
  112. }}</i
  113. >
  114. </div>
  115. <p>{{ station.description }}</p>
  116. </div>
  117. <div id="admin-buttons" v-if="isOwnerOrAdmin()">
  118. <!-- (Admin) Pause/Resume Button -->
  119. <button
  120. class="button is-danger"
  121. v-if="stationPaused"
  122. @click="resumeStation()"
  123. >
  124. <i class="material-icons icon-with-button"
  125. >play_arrow</i
  126. >
  127. <span> Resume Station </span>
  128. </button>
  129. <button
  130. class="button is-danger"
  131. @click="pauseStation()"
  132. v-else
  133. >
  134. <i class="material-icons icon-with-button"
  135. >pause</i
  136. >
  137. <span> Pause Station </span>
  138. </button>
  139. <!-- (Admin) Skip Button -->
  140. <button
  141. class="button is-danger"
  142. @click="skipStation()"
  143. >
  144. <i class="material-icons icon-with-button"
  145. >skip_next</i
  146. >
  147. <span> Force Skip </span>
  148. </button>
  149. <!-- (Admin) Station Settings Button -->
  150. <button
  151. class="button is-primary"
  152. @click="openModal('manageStation')"
  153. >
  154. <i class="material-icons icon-with-button"
  155. >settings</i
  156. >
  157. <span> Manage Station </span>
  158. </button>
  159. </div>
  160. </div>
  161. <div id="sidebar-container" class="quadrant">
  162. <station-sidebar />
  163. </div>
  164. </div>
  165. <div id="station-right-column" class="column">
  166. <div class="player-container quadrant" v-show="!noSong">
  167. <div id="video-container">
  168. <div
  169. id="stationPlayer"
  170. style="
  171. width: 100%;
  172. height: 100%;
  173. min-height: 200px;
  174. "
  175. />
  176. <div
  177. class="player-cannot-autoplay"
  178. v-if="!canAutoplay"
  179. @click="
  180. increaseVolume() && decreaseVolume()
  181. "
  182. >
  183. <p>
  184. Please click anywhere on the screen for
  185. the video to start
  186. </p>
  187. </div>
  188. </div>
  189. <div id="seeker-bar-container">
  190. <div
  191. id="seeker-bar"
  192. :style="{
  193. width: `${seekerbarPercentage}%`
  194. }"
  195. :class="{
  196. nyan:
  197. currentSong &&
  198. currentSong.youtubeId ===
  199. 'QH2-TGUlwu4'
  200. }"
  201. />
  202. <img
  203. v-if="
  204. currentSong &&
  205. currentSong.youtubeId === 'QH2-TGUlwu4'
  206. "
  207. src="https://freepngimg.com/thumb/nyan_cat/1-2-nyan-cat-free-download-png.png"
  208. :style="{
  209. position: 'absolute',
  210. top: `-10px`,
  211. left: `${seekerbarPercentage}%`,
  212. width: '50px'
  213. }"
  214. />
  215. <img
  216. v-if="
  217. currentSong &&
  218. (currentSong.youtubeId ===
  219. 'DtVBCG6ThDk' ||
  220. currentSong.youtubeId ===
  221. 'sI66hcu9fIs' ||
  222. currentSong.youtubeId ===
  223. 'iYYRH4apXDo' ||
  224. currentSong.youtubeId ===
  225. 'tRcPA7Fzebw')
  226. "
  227. src="/assets/rocket.svg"
  228. :style="{
  229. position: 'absolute',
  230. top: `-21px`,
  231. left: `calc(${seekerbarPercentage}% - 35px)`,
  232. width: '50px',
  233. transform: 'rotate(45deg)'
  234. }"
  235. />
  236. <img
  237. v-if="
  238. currentSong &&
  239. currentSong.youtubeId === 'jofNR_WkoCE'
  240. "
  241. src="/assets/fox.svg"
  242. :style="{
  243. position: 'absolute',
  244. top: `-21px`,
  245. left: `calc(${seekerbarPercentage}% - 35px)`,
  246. width: '50px',
  247. transform: 'scaleX(-1)',
  248. opacity: 1
  249. }"
  250. />
  251. <img
  252. v-if="
  253. currentSong &&
  254. (currentSong.youtubeId ===
  255. 'l9PxOanFjxQ' ||
  256. currentSong.youtubeId ===
  257. 'xKVcVSYmesU' ||
  258. currentSong.youtubeId ===
  259. '60ItHLz5WEA' ||
  260. currentSong.youtubeId ===
  261. 'e6vkFbtSGm0')
  262. "
  263. src="/assets/old_logo.png"
  264. :style="{
  265. position: 'absolute',
  266. top: `-9px`,
  267. left: `calc(${seekerbarPercentage}% - 22px)`,
  268. 'background-color': 'rgb(96, 199, 169)',
  269. width: '25px',
  270. height: '25px',
  271. 'border-radius': '25px'
  272. }"
  273. />
  274. </div>
  275. <div id="control-bar-container">
  276. <div id="left-buttons">
  277. <!-- Debug Box -->
  278. <button
  279. v-if="frontendDevMode === 'development'"
  280. class="button is-primary"
  281. @click="togglePlayerDebugBox()"
  282. @dblclick="resetPlayerDebugBox()"
  283. content="Debug"
  284. v-tippy
  285. >
  286. <i
  287. class="
  288. material-icons
  289. icon-with-button
  290. "
  291. >
  292. bug_report
  293. </i>
  294. </button>
  295. <!-- Local Pause/Resume Button -->
  296. <button
  297. class="button is-primary"
  298. @click="resumeLocalStation()"
  299. id="local-resume"
  300. v-if="localPaused"
  301. content="Unpause Playback"
  302. v-tippy
  303. >
  304. <i class="material-icons">play_arrow</i>
  305. </button>
  306. <button
  307. class="button is-primary"
  308. @click="pauseLocalStation()"
  309. id="local-pause"
  310. v-else
  311. content="Pause Playback"
  312. v-tippy
  313. >
  314. <i class="material-icons">pause</i>
  315. </button>
  316. <!-- Vote to Skip Button -->
  317. <button
  318. v-if="!skipVotesLoaded"
  319. class="button is-primary disabled"
  320. content="Skip votes have not been loaded yet"
  321. v-tippy
  322. >
  323. <i
  324. class="
  325. material-icons
  326. icon-with-button
  327. "
  328. >skip_next</i
  329. >
  330. </button>
  331. <button
  332. v-else-if="loggedIn"
  333. class="button is-primary"
  334. @click="voteSkipStation()"
  335. content="Vote to Skip Song"
  336. v-tippy
  337. >
  338. <i
  339. class="
  340. material-icons
  341. icon-with-button
  342. "
  343. >skip_next</i
  344. >
  345. {{ currentSong.skipVotes }}
  346. </button>
  347. <button
  348. v-else
  349. class="button is-primary disabled"
  350. content="Log in to vote to skip songs"
  351. v-tippy="{ theme: 'info' }"
  352. >
  353. <i
  354. class="
  355. material-icons
  356. icon-with-button
  357. "
  358. >skip_next</i
  359. >
  360. {{ currentSong.skipVotes }}
  361. </button>
  362. </div>
  363. <div id="duration">
  364. <p>
  365. {{ timeElapsed }} /
  366. {{
  367. utils.formatTime(
  368. currentSong.duration
  369. )
  370. }}
  371. </p>
  372. </div>
  373. <p id="volume-control" v-if="!isApple">
  374. <i
  375. v-if="muted"
  376. class="material-icons"
  377. @click="toggleMute()"
  378. content="Unmute"
  379. v-tippy
  380. >volume_mute</i
  381. >
  382. <i
  383. v-else
  384. class="material-icons"
  385. @click="toggleMute()"
  386. content="Mute"
  387. v-tippy
  388. >volume_down</i
  389. >
  390. <input
  391. v-model="volumeSliderValue"
  392. type="range"
  393. min="0"
  394. max="10000"
  395. class="volume-slider active"
  396. @change="changeVolume()"
  397. @input="changeVolume()"
  398. />
  399. <i
  400. class="material-icons"
  401. @click="increaseVolume()"
  402. content="Increase Volume"
  403. v-tippy
  404. >volume_up</i
  405. >
  406. </p>
  407. <div id="right-buttons" v-if="loggedIn">
  408. <!-- Ratings (Like/Dislike) Buttons -->
  409. <div
  410. id="ratings"
  411. v-if="ratingsLoaded && ownRatingsLoaded"
  412. :class="{
  413. liked: currentSong.liked,
  414. disliked: currentSong.disliked
  415. }"
  416. >
  417. <!-- Like Song Button -->
  418. <button
  419. class="button is-success like-song"
  420. id="like-song"
  421. @click="toggleLike()"
  422. content="Like Song"
  423. v-tippy
  424. >
  425. <i
  426. class="
  427. material-icons
  428. icon-with-button
  429. "
  430. :class="{
  431. liked: currentSong.liked
  432. }"
  433. >thumb_up_alt</i
  434. >{{ currentSong.likes }}
  435. </button>
  436. <!-- Dislike Song Button -->
  437. <button
  438. class="
  439. button
  440. is-danger
  441. dislike-song
  442. "
  443. id="dislike-song"
  444. @click="toggleDislike()"
  445. content="Dislike Song"
  446. v-tippy
  447. >
  448. <i
  449. class="
  450. material-icons
  451. icon-with-button
  452. "
  453. :class="{
  454. disliked:
  455. currentSong.disliked
  456. }"
  457. >thumb_down_alt</i
  458. >{{ currentSong.dislikes }}
  459. </button>
  460. </div>
  461. <div id="ratings" class="disabled" v-else>
  462. <!-- Like Song Button -->
  463. <button
  464. class="
  465. button
  466. is-success
  467. like-song
  468. disabled
  469. "
  470. id="like-song"
  471. content="Ratings have not been loaded yet"
  472. v-tippy
  473. >
  474. <i
  475. class="
  476. material-icons
  477. icon-with-button
  478. "
  479. >thumb_up_alt</i
  480. >
  481. </button>
  482. <!-- Dislike Song Button -->
  483. <button
  484. class="
  485. button
  486. is-danger
  487. dislike-song
  488. disabled
  489. "
  490. id="dislike-song"
  491. content="Ratings have not been loaded yet"
  492. v-tippy
  493. >
  494. <i
  495. class="
  496. material-icons
  497. icon-with-button
  498. "
  499. >thumb_down_alt</i
  500. >
  501. </button>
  502. </div>
  503. <!-- Add Song To Playlist Button & Dropdown -->
  504. <add-to-playlist-dropdown
  505. :song="currentSong"
  506. placement="top-end"
  507. >
  508. <template #button>
  509. <div
  510. id="add-song-to-playlist"
  511. content="Add Song to Playlist"
  512. v-tippy
  513. >
  514. <div class="control has-addons">
  515. <button
  516. class="
  517. button
  518. is-primary
  519. "
  520. >
  521. <i
  522. class="
  523. material-icons
  524. "
  525. >
  526. playlist_add
  527. </i>
  528. </button>
  529. <button
  530. class="button"
  531. id="dropdown-toggle"
  532. >
  533. <i
  534. class="
  535. material-icons
  536. "
  537. >
  538. {{
  539. showPlaylistDropdown
  540. ? "expand_more"
  541. : "expand_less"
  542. }}
  543. </i>
  544. </button>
  545. </div>
  546. </div>
  547. </template>
  548. </add-to-playlist-dropdown>
  549. </div>
  550. <div id="right-buttons" v-else>
  551. <!-- Disabled Ratings (Like/Dislike) Buttons -->
  552. <div id="ratings" v-if="ratingsLoaded">
  553. <!-- Disabled Like Song Button -->
  554. <button
  555. class="button is-success disabled"
  556. id="like-song"
  557. content="Log in to like songs"
  558. v-tippy="{ theme: 'info' }"
  559. >
  560. <i
  561. class="
  562. material-icons
  563. icon-with-button
  564. "
  565. >thumb_up_alt</i
  566. >{{ currentSong.likes }}
  567. </button>
  568. <!-- Disabled Dislike Song Button -->
  569. <button
  570. class="button is-danger disabled"
  571. id="dislike-song"
  572. content="Log in to dislike songs"
  573. v-tippy="{ theme: 'info' }"
  574. >
  575. <i
  576. class="
  577. material-icons
  578. icon-with-button
  579. "
  580. >thumb_down_alt</i
  581. >{{ currentSong.dislikes }}
  582. </button>
  583. </div>
  584. <div id="ratings" v-else>
  585. <!-- Disabled Like Song Button -->
  586. <button
  587. class="button is-success disabled"
  588. id="like-song"
  589. content="Ratings have not been loaded yet"
  590. v-tippy="{ theme: 'info' }"
  591. >
  592. <i
  593. class="
  594. material-icons
  595. icon-with-button
  596. "
  597. >thumb_up_alt</i
  598. >
  599. </button>
  600. <!-- Disabled Dislike Song Button -->
  601. <button
  602. class="button is-danger disabled"
  603. id="dislike-song"
  604. content="Ratings have not been loaded yet"
  605. v-tippy="{ theme: 'info' }"
  606. >
  607. <i
  608. class="
  609. material-icons
  610. icon-with-button
  611. "
  612. >thumb_down_alt</i
  613. >
  614. </button>
  615. </div>
  616. <!-- Disabled Add Song To Playlist Button & Dropdown -->
  617. <div id="add-song-to-playlist">
  618. <div class="control has-addons">
  619. <button
  620. class="
  621. button
  622. is-primary
  623. disabled
  624. "
  625. content="Log in to add songs to playlist"
  626. v-tippy="{ theme: 'info' }"
  627. >
  628. <i class="material-icons"
  629. >queue</i
  630. >
  631. </button>
  632. </div>
  633. </div>
  634. </div>
  635. </div>
  636. </div>
  637. <p
  638. class="player-container nothing-here-text"
  639. v-if="noSong"
  640. >
  641. No song is currently playing
  642. </p>
  643. <div v-if="!noSong" id="current-next-row">
  644. <div
  645. id="currently-playing-container"
  646. class="quadrant"
  647. :class="{ 'no-currently-playing': noSong }"
  648. >
  649. <song-item
  650. :song="currentSong"
  651. :duration="false"
  652. :requested-by="
  653. station.type === 'community' &&
  654. station.partyMode === true
  655. "
  656. header="Currently Playing.."
  657. />
  658. </div>
  659. <div
  660. v-if="nextSong"
  661. id="next-up-container"
  662. class="quadrant"
  663. >
  664. <song-item
  665. :song="nextSong"
  666. :duration="false"
  667. :requested-by="
  668. station.type === 'community' &&
  669. station.partyMode === true
  670. "
  671. header="Next Up.."
  672. />
  673. </div>
  674. </div>
  675. </div>
  676. </div>
  677. <request-song v-if="modals.requestSong" />
  678. <edit-playlist v-if="modals.editPlaylist" />
  679. <create-playlist v-if="modals.createPlaylist" />
  680. <manage-station
  681. v-if="modals.manageStation"
  682. :station-id="station._id"
  683. sector="station"
  684. />
  685. <edit-song
  686. v-if="modals.editSong"
  687. song-type="songs"
  688. sector="station"
  689. />
  690. <report v-if="modals.report" />
  691. </div>
  692. <main-footer />
  693. </div>
  694. <floating-box id="player-debug-box" ref="playerDebugBox">
  695. <template #body>
  696. <span><b>No song</b>: {{ noSong }}</span>
  697. <span><b>Song id</b>: {{ currentSong._id }}</span>
  698. <span><b>YouTube id</b>: {{ currentSong.youtubeId }}</span>
  699. <span><b>Duration</b>: {{ currentSong.duration }}</span>
  700. <span
  701. ><b>Skip duration</b>: {{ currentSong.skipDuration }}</span
  702. >
  703. <span><b>Loading</b>: {{ loading }}</span>
  704. <span><b>Can autoplay</b>: {{ canAutoplay }}</span>
  705. <span><b>Player ready</b>: {{ playerReady }}</span>
  706. <span
  707. ><b>Attempts to play video</b>:
  708. {{ attemptsToPlayVideo }}</span
  709. >
  710. <span
  711. ><b>Last time requested if can autoplay</b>:
  712. {{ lastTimeRequestedIfCanAutoplay }}</span
  713. >
  714. <span><b>Seeking</b>: {{ seeking }}</span>
  715. <span><b>Playback rate</b>: {{ playbackRate }}</span>
  716. <span><b>System difference</b>: {{ systemDifference }}</span>
  717. <span><b>Time before paused</b>: {{ timeBeforePause }}</span>
  718. <span><b>Time paused</b>: {{ timePaused }}</span>
  719. <span><b>Time elapsed</b>: {{ timeElapsed }}</span>
  720. <span><b>Volume slider value</b>: {{ volumeSliderValue }}</span>
  721. <span><b>Local paused</b>: {{ localPaused }}</span>
  722. <span><b>Station paused</b>: {{ stationPaused }}</span>
  723. <span
  724. ><b>Party playlists selected</b>: {{ partyPlaylists }}</span
  725. >
  726. <span><b>Skip votes loaded</b>: {{ skipVotesLoaded }}</span>
  727. <span
  728. ><b>Skip votes current</b>:
  729. {{
  730. currentSong.skipVotesCurrent === true ||
  731. currentSong.skipVotesCurrent === false
  732. ? currentSong.skipVotesCurrent
  733. : "N/A"
  734. }}</span
  735. >
  736. <span
  737. ><b>Skip votes</b>:
  738. {{ skipVotesLoaded ? currentSong.skipVotes : "N/A" }}</span
  739. >
  740. <span><b>Ratings loaded</b>: {{ ratingsLoaded }}</span>
  741. <span
  742. ><b>Ratings</b>:
  743. {{
  744. ratingsLoaded
  745. ? `${currentSong.likes} / ${currentSong.dislikes}`
  746. : "N/A"
  747. }}</span
  748. >
  749. <span><b>Own ratings loaded</b>: {{ ownRatingsLoaded }}</span>
  750. <span
  751. ><b>Own ratings</b>:
  752. {{
  753. ownRatingsLoaded
  754. ? `${currentSong.liked} / ${currentSong.disliked}`
  755. : "N/A"
  756. }}</span
  757. >
  758. </template>
  759. </floating-box>
  760. <floating-box
  761. id="keyboardShortcutsHelper"
  762. ref="keyboardShortcutsHelper"
  763. >
  764. <template #body>
  765. <div>
  766. <div v-if="isOwnerOrAdmin()">
  767. <span class="biggest"><b>Admin/owner</b></span>
  768. <span><b>Ctrl + Space</b> - Pause/resume station</span>
  769. <span><b>Ctrl + Numpad right</b> - Skip station</span>
  770. </div>
  771. <hr v-if="isOwnerOrAdmin()" />
  772. <div>
  773. <span class="biggest"><b>Volume</b></span>
  774. <span
  775. ><b>Ctrl + Numpad up/down</b> - Volume up/down
  776. 10%</span
  777. >
  778. <span
  779. ><b>Ctrl + Shift + Numpad up/down</b> - Volume
  780. up/down 10%</span
  781. >
  782. </div>
  783. <hr />
  784. <div>
  785. <span class="biggest"><b>Misc</b></span>
  786. <span><b>Ctrl + D</b> - Toggles debug box</span>
  787. <span><b>Ctrl + Shift + D</b> - Resets debug box</span>
  788. <span
  789. ><b>Ctrl + /</b> - Toggles keyboard shortcuts
  790. box</span
  791. >
  792. <span
  793. ><b>Ctrl + Shift + /</b> - Resets keyboard shortcuts
  794. box</span
  795. >
  796. </div>
  797. </div>
  798. </template>
  799. </floating-box>
  800. <Z404 v-if="!exists"></Z404>
  801. </div>
  802. </template>
  803. <script>
  804. import { mapState, mapActions, mapGetters } from "vuex";
  805. import { defineAsyncComponent } from "vue";
  806. import Toast from "toasters";
  807. import { ContentLoader } from "vue-content-loader";
  808. import aw from "@/aw";
  809. import ws from "@/ws";
  810. import keyboardShortcuts from "@/keyboardShortcuts";
  811. import MainHeader from "@/components/layout/MainHeader.vue";
  812. import MainFooter from "@/components/layout/MainFooter.vue";
  813. import FloatingBox from "@/components/FloatingBox.vue";
  814. import AddToPlaylistDropdown from "@/components/AddToPlaylistDropdown.vue";
  815. import SongItem from "@/components/SongItem.vue";
  816. import Z404 from "../404.vue";
  817. import utils from "../../../js/utils";
  818. import StationSidebar from "./Sidebar/index.vue";
  819. export default {
  820. components: {
  821. ContentLoader,
  822. MainHeader,
  823. MainFooter,
  824. RequestSong: defineAsyncComponent(() =>
  825. import("@/components/modals/RequestSong.vue")
  826. ),
  827. EditPlaylist: defineAsyncComponent(() =>
  828. import("@/components/modals/EditPlaylist")
  829. ),
  830. CreatePlaylist: defineAsyncComponent(() =>
  831. import("@/components/modals/CreatePlaylist.vue")
  832. ),
  833. ManageStation: defineAsyncComponent(() =>
  834. import("@/components/modals/ManageStation/index.vue")
  835. ),
  836. Report: defineAsyncComponent(() =>
  837. import("@/components/modals/Report.vue")
  838. ),
  839. Z404,
  840. FloatingBox,
  841. StationSidebar,
  842. AddToPlaylistDropdown,
  843. EditSong: defineAsyncComponent(() =>
  844. import("@/components/modals/EditSong")
  845. ),
  846. SongItem
  847. },
  848. data() {
  849. return {
  850. utils,
  851. isApple:
  852. navigator.platform.match(/iPhone|iPod|iPad/) ||
  853. navigator.vendor === "Apple Computer, Inc.",
  854. title: "Station",
  855. loading: true,
  856. exists: true,
  857. playerReady: false,
  858. player: undefined,
  859. timePaused: 0,
  860. muted: false,
  861. timeElapsed: "0:00",
  862. timeBeforePause: 0,
  863. systemDifference: 0,
  864. attemptsToPlayVideo: 0,
  865. canAutoplay: true,
  866. lastTimeRequestedIfCanAutoplay: 0,
  867. seeking: false,
  868. playbackRate: 1,
  869. volumeSliderValue: 0,
  870. showPlaylistDropdown: false,
  871. theme: "var(--primary-color)",
  872. seekerbarPercentage: 0,
  873. frontendDevMode: "production",
  874. activityWatchVideoDataInterval: null,
  875. activityWatchVideoLastStatus: "",
  876. activityWatchVideoLastYouTubeId: "",
  877. activityWatchVideoLastStartDuration: "",
  878. nextCurrentSong: null,
  879. editSongModalWatcher: null,
  880. beforeEditSongModalLocalPaused: null,
  881. socketConnected: null,
  882. persistentToastCheckerInterval: null,
  883. persistentToasts: [],
  884. partyPlaylistLock: false
  885. };
  886. },
  887. computed: {
  888. skipVotesLoaded() {
  889. return (
  890. !this.noSong &&
  891. Number.isInteger(this.currentSong.skipVotes) &&
  892. this.currentSong.skipVotes >= 0
  893. );
  894. },
  895. ratingsLoaded() {
  896. return (
  897. !this.noSong &&
  898. Number.isInteger(this.currentSong.likes) &&
  899. Number.isInteger(this.currentSong.dislikes) &&
  900. this.currentSong.likes >= 0 &&
  901. this.currentSong.dislikes >= 0
  902. );
  903. },
  904. ownRatingsLoaded() {
  905. return (
  906. !this.noSong &&
  907. typeof this.currentSong.liked === "boolean" &&
  908. typeof this.currentSong.disliked === "boolean"
  909. );
  910. },
  911. aModalIsOpen() {
  912. return Object.keys(this.currentlyActive).length > 0;
  913. },
  914. currentUserQueueSongs() {
  915. return this.songsList.filter(
  916. queueSong => queueSong.requestedBy === this.userId
  917. ).length;
  918. },
  919. ...mapState("modalVisibility", {
  920. modals: state => state.modals,
  921. currentlyActive: state => state.currentlyActive
  922. }),
  923. ...mapState("modals/editSong", {
  924. video: state => state.video
  925. }),
  926. ...mapState("station", {
  927. station: state => state.station,
  928. currentSong: state => state.currentSong,
  929. nextSong: state => state.nextSong,
  930. songsList: state => state.songsList,
  931. stationPaused: state => state.stationPaused,
  932. localPaused: state => state.localPaused,
  933. noSong: state => state.noSong,
  934. partyPlaylists: state => state.partyPlaylists,
  935. includedPlaylists: state => state.includedPlaylists,
  936. excludedPlaylists: state => state.excludedPlaylists
  937. }),
  938. ...mapState({
  939. loggedIn: state => state.user.auth.loggedIn,
  940. userId: state => state.user.auth.userId,
  941. role: state => state.user.auth.role,
  942. nightmode: state => state.user.preferences.nightmode,
  943. autoSkipDisliked: state => state.user.preferences.autoSkipDisliked
  944. }),
  945. ...mapGetters({
  946. socket: "websockets/getSocket"
  947. })
  948. },
  949. async mounted() {
  950. this.editSongModalWatcher = this.$store.watch(
  951. state => state.modals.editSong.video.paused,
  952. paused => {
  953. if (paused && !this.beforeEditSongModalLocalPaused) {
  954. this.resumeLocalStation();
  955. } else if (!paused) {
  956. this.beforeEditSongModalLocalPaused = this.localPaused;
  957. this.pauseLocalStation();
  958. }
  959. }
  960. );
  961. window.scrollTo(0, 0);
  962. Date.currently = () => new Date().getTime() + this.systemDifference;
  963. this.stationIdentifier = this.$route.params.id;
  964. window.stationInterval = 0;
  965. this.activityWatchVideoDataInterval = setInterval(() => {
  966. this.sendActivityWatchVideoData();
  967. }, 1000);
  968. this.persistentToastCheckerInterval = setInterval(() => {
  969. this.persistentToasts.filter(
  970. persistentToast => !persistentToast.checkIfCanRemove()
  971. );
  972. }, 1000);
  973. if (this.socket.readyState === 1) this.join();
  974. ws.onConnect(() => {
  975. this.socketConnected = true;
  976. clearTimeout(window.stationNextSongTimeout);
  977. this.join();
  978. });
  979. ws.onDisconnect(true, () => {
  980. this.socketConnected = false;
  981. const { currentSong } = this.currentSong;
  982. if (this.nextSong)
  983. this.setNextCurrentSong(
  984. {
  985. currentSong: this.nextSong,
  986. startedAt: Date.now() + this.getTimeRemaining(),
  987. paused: false,
  988. timePaused: 0
  989. },
  990. true
  991. );
  992. else
  993. this.setNextCurrentSong(
  994. {
  995. currentSong: null,
  996. startedAt: 0,
  997. paused: false,
  998. timePaused: 0,
  999. pausedAt: 0
  1000. },
  1001. true
  1002. );
  1003. window.stationNextSongTimeout = setTimeout(() => {
  1004. if (!this.noSong && this.currentSong._id === currentSong._id)
  1005. this.skipSong("window.stationNextSongTimeout 2");
  1006. }, this.getTimeRemaining());
  1007. });
  1008. this.frontendDevMode = await lofig.get("mode");
  1009. this.socket.dispatch(
  1010. "stations.existsByName",
  1011. this.stationIdentifier,
  1012. res => {
  1013. if (res.status === "error" || !res.data.exists) {
  1014. // station identifier may be using stationid instead
  1015. this.socket.dispatch(
  1016. "stations.existsById",
  1017. this.stationIdentifier,
  1018. res => {
  1019. if (res.status === "error" || !res.data.exists) {
  1020. this.loading = false;
  1021. this.exists = false;
  1022. }
  1023. }
  1024. );
  1025. }
  1026. }
  1027. );
  1028. this.socket.on("event:station.nextSong", res => {
  1029. const { currentSong, startedAt, paused, timePaused } = res.data;
  1030. this.setCurrentSong({
  1031. currentSong,
  1032. startedAt,
  1033. paused,
  1034. timePaused,
  1035. pausedAt: 0
  1036. });
  1037. });
  1038. this.socket.on("event:station.pause", res => {
  1039. this.pausedAt = res.data.pausedAt;
  1040. this.updateStationPaused(true);
  1041. this.pauseLocalPlayer();
  1042. clearTimeout(window.stationNextSongTimeout);
  1043. });
  1044. this.socket.on("event:station.resume", res => {
  1045. this.timePaused = res.data.timePaused;
  1046. this.updateStationPaused(false);
  1047. if (!this.localPaused) this.resumeLocalPlayer();
  1048. });
  1049. this.socket.on("event:station.deleted", () => {
  1050. window.location.href = "/?msg=The station you were in was deleted.";
  1051. return true;
  1052. });
  1053. this.socket.on("event:song.liked", res => {
  1054. if (!this.noSong) {
  1055. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1056. this.updateCurrentSongRatings(res.data);
  1057. }
  1058. }
  1059. });
  1060. this.socket.on("event:song.disliked", res => {
  1061. if (!this.noSong) {
  1062. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1063. this.updateCurrentSongRatings(res.data);
  1064. }
  1065. }
  1066. });
  1067. this.socket.on("event:song.unliked", res => {
  1068. if (!this.noSong) {
  1069. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1070. this.updateCurrentSongRatings(res.data);
  1071. }
  1072. }
  1073. });
  1074. this.socket.on("event:song.undisliked", res => {
  1075. if (!this.noSong) {
  1076. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1077. this.updateCurrentSongRatings(res.data);
  1078. }
  1079. }
  1080. });
  1081. this.socket.on("event:song.ratings.updated", res => {
  1082. if (!this.noSong) {
  1083. if (res.data.youtubeId === this.currentSong.youtubeId) {
  1084. this.updateOwnCurrentSongRatings(res.data);
  1085. }
  1086. }
  1087. });
  1088. this.socket.on("event:station.queue.updated", res => {
  1089. this.updateSongsList(res.data.queue);
  1090. let nextSong = null;
  1091. if (this.songsList[0])
  1092. nextSong = this.songsList[0].youtubeId
  1093. ? this.songsList[0]
  1094. : null;
  1095. this.updateNextSong(nextSong);
  1096. this.addPartyPlaylistSongToQueue();
  1097. });
  1098. this.socket.on("event:station.queue.song.repositioned", res => {
  1099. this.repositionSongInList(res.data.song);
  1100. let nextSong = null;
  1101. if (this.songsList[0])
  1102. nextSong = this.songsList[0].youtubeId
  1103. ? this.songsList[0]
  1104. : null;
  1105. this.updateNextSong(nextSong);
  1106. });
  1107. this.socket.on("event:station.voteSkipSong", () => {
  1108. if (this.currentSong)
  1109. this.updateCurrentSongSkipVotes({
  1110. skipVotes: this.currentSong.skipVotes + 1,
  1111. skipVotesCurrent: null
  1112. });
  1113. });
  1114. this.socket.on("event:privatePlaylist.selected", res => {
  1115. if (this.station.type === "community")
  1116. this.station.privatePlaylist = res.data.playlistId;
  1117. });
  1118. this.socket.on("event:privatePlaylist.deselected", () => {
  1119. if (this.station.type === "community")
  1120. this.station.privatePlaylist = null;
  1121. });
  1122. this.socket.on("event:station.partyMode.updated", res => {
  1123. if (this.station.type === "community")
  1124. this.station.partyMode = res.data.partyMode;
  1125. });
  1126. this.socket.on("event:station.theme.updated", res => {
  1127. const { theme } = res.data;
  1128. this.station.theme = theme;
  1129. document.body.style.cssText = `--primary-color: var(--${theme})`;
  1130. });
  1131. this.socket.on("event:station.name.updated", async res => {
  1132. this.station.name = res.data.name;
  1133. await this.$router.push(
  1134. `${res.data.name}?${Object.keys(this.$route.query)
  1135. .map(
  1136. key =>
  1137. `${encodeURIComponent(key)}=${encodeURIComponent(
  1138. this.$route.query[key]
  1139. )}`
  1140. )
  1141. .join("&")}`
  1142. );
  1143. // eslint-disable-next-line no-restricted-globals
  1144. history.replaceState({ ...history.state, ...{} }, null);
  1145. });
  1146. this.socket.on("event:station.displayName.updated", res => {
  1147. this.station.displayName = res.data.displayName;
  1148. });
  1149. this.socket.on("event:station.description.updated", res => {
  1150. this.station.description = res.data.description;
  1151. });
  1152. this.socket.on("event:station.users.updated", res =>
  1153. this.updateUsers(res.data.users)
  1154. );
  1155. this.socket.on("event:station.userCount.updated", res =>
  1156. this.updateUserCount(res.data.userCount)
  1157. );
  1158. this.socket.on("event:station.queue.lock.toggled", res => {
  1159. this.station.locked = res.data.locked;
  1160. });
  1161. this.socket.on("event:user.station.favorited", res => {
  1162. if (res.data.stationId === this.station._id)
  1163. this.updateIfStationIsFavorited({ isFavorited: true });
  1164. });
  1165. this.socket.on("event:user.station.unfavorited", res => {
  1166. if (res.data.stationId === this.station._id)
  1167. this.updateIfStationIsFavorited({ isFavorited: false });
  1168. });
  1169. if (JSON.parse(localStorage.getItem("muted"))) {
  1170. this.muted = true;
  1171. this.player.setVolume(0);
  1172. this.volumeSliderValue = 0 * 100;
  1173. } else {
  1174. let volume = parseFloat(localStorage.getItem("volume"));
  1175. volume =
  1176. typeof volume === "number" && !Number.isNaN(volume)
  1177. ? volume
  1178. : 20;
  1179. localStorage.setItem("volume", volume);
  1180. this.volumeSliderValue = volume * 100;
  1181. }
  1182. },
  1183. beforeUnmount() {
  1184. document.body.style.cssText = "";
  1185. /** Reset Songslist */
  1186. this.updateSongsList([]);
  1187. const shortcutNames = [
  1188. "station.pauseResume",
  1189. "station.skipStation",
  1190. "station.lowerVolumeLarge",
  1191. "station.lowerVolumeSmall",
  1192. "station.increaseVolumeLarge",
  1193. "station.increaseVolumeSmall",
  1194. "station.toggleDebug"
  1195. ];
  1196. shortcutNames.forEach(shortcutName => {
  1197. keyboardShortcuts.unregisterShortcut(shortcutName);
  1198. });
  1199. this.editSongModalWatcher(); // removes the watcher
  1200. clearInterval(this.activityWatchVideoDataInterval);
  1201. clearTimeout(window.stationNextSongTimeout);
  1202. clearTimeout(this.persistentToastCheckerInterval);
  1203. this.persistentToasts.forEach(persistentToast => {
  1204. persistentToast.toast.destroy();
  1205. });
  1206. this.socket.dispatch("stations.leave", this.station._id, () => {});
  1207. this.leaveStation();
  1208. },
  1209. methods: {
  1210. isOwnerOnly() {
  1211. return this.loggedIn && this.userId === this.station.owner;
  1212. },
  1213. isAdminOnly() {
  1214. return this.loggedIn && this.role === "admin";
  1215. },
  1216. isOwnerOrAdmin() {
  1217. return this.isOwnerOnly() || this.isAdminOnly();
  1218. },
  1219. removeFromQueue(youtubeId) {
  1220. window.socket.dispatch(
  1221. "stations.removeFromQueue",
  1222. this.station._id,
  1223. youtubeId,
  1224. res => {
  1225. if (res.status === "success") {
  1226. new Toast("Successfully removed song from the queue.");
  1227. } else new Toast(res.message);
  1228. }
  1229. );
  1230. },
  1231. setNextCurrentSong(nextCurrentSong, skipSkipCheck = false) {
  1232. this.nextCurrentSong = nextCurrentSong;
  1233. // If skipSkipCheck is true, it won't try to skip the song
  1234. if (this.getTimeRemaining() <= 0 && !skipSkipCheck) {
  1235. this.skipSong();
  1236. }
  1237. },
  1238. skipSong() {
  1239. if (this.nextCurrentSong && this.nextCurrentSong.currentSong) {
  1240. const songsList = this.songsList.concat([]);
  1241. if (
  1242. songsList.length > 0 &&
  1243. songsList[0].youtubeId ===
  1244. this.nextCurrentSong.currentSong.youtubeId
  1245. ) {
  1246. songsList.splice(0, 1);
  1247. this.updateSongsList(songsList);
  1248. }
  1249. this.setCurrentSong(this.nextCurrentSong);
  1250. } else {
  1251. this.setCurrentSong({
  1252. currentSong: null,
  1253. startedAt: 0,
  1254. paused: this.stationPaused,
  1255. timePaused: 0,
  1256. pausedAt: 0
  1257. });
  1258. }
  1259. },
  1260. setCurrentSong(data) {
  1261. const { currentSong, startedAt, paused, timePaused, pausedAt } =
  1262. data;
  1263. if (currentSong) {
  1264. if (!currentSong.skipDuration || currentSong.skipDuration < 0)
  1265. currentSong.skipDuration = 0;
  1266. if (!currentSong.duration || currentSong.duration < 0)
  1267. currentSong.duration = 0;
  1268. }
  1269. this.updateCurrentSong(currentSong || {});
  1270. let nextSong = null;
  1271. if (this.songsList[0])
  1272. nextSong = this.songsList[0].youtubeId
  1273. ? this.songsList[0]
  1274. : null;
  1275. this.updateNextSong(nextSong);
  1276. this.setNextCurrentSong(
  1277. {
  1278. currentSong: null,
  1279. startedAt: 0,
  1280. paused,
  1281. timePaused: 0,
  1282. pausedAt: 0
  1283. },
  1284. true
  1285. );
  1286. clearTimeout(window.stationNextSongTimeout);
  1287. this.startedAt = startedAt;
  1288. this.updateStationPaused(paused);
  1289. this.timePaused = timePaused;
  1290. this.pausedAt = pausedAt;
  1291. if (currentSong) {
  1292. this.updateNoSong(false);
  1293. if (!this.playerReady) this.youtubeReady();
  1294. else this.playVideo();
  1295. // 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
  1296. if (!this.stationPaused && !this.socketConnected) {
  1297. if (this.nextSong)
  1298. this.setNextCurrentSong(
  1299. {
  1300. currentSong: this.nextSong,
  1301. startedAt: Date.now() + this.getTimeRemaining(),
  1302. paused: false,
  1303. timePaused: 0
  1304. },
  1305. true
  1306. );
  1307. else
  1308. this.setNextCurrentSong(
  1309. {
  1310. currentSong: null,
  1311. startedAt: 0,
  1312. paused: false,
  1313. timePaused: 0,
  1314. pausedAt: 0
  1315. },
  1316. true
  1317. );
  1318. window.stationNextSongTimeout = setTimeout(() => {
  1319. if (
  1320. !this.noSong &&
  1321. this.currentSong._id === currentSong._id
  1322. )
  1323. this.skipSong("window.stationNextSongTimeout 1");
  1324. }, this.getTimeRemaining());
  1325. }
  1326. const currentSongId = this.currentSong._id;
  1327. this.socket.dispatch(
  1328. "stations.getSkipVotes",
  1329. this.station._id,
  1330. currentSongId,
  1331. res => {
  1332. if (res.status === "success") {
  1333. const { skipVotes, skipVotesCurrent } = res.data;
  1334. if (
  1335. !this.noSong &&
  1336. this.currentSong._id === currentSongId
  1337. ) {
  1338. this.updateCurrentSongSkipVotes({
  1339. skipVotes,
  1340. skipVotesCurrent
  1341. });
  1342. }
  1343. }
  1344. }
  1345. );
  1346. this.socket.dispatch(
  1347. "songs.getSongRatings",
  1348. currentSong._id,
  1349. res => {
  1350. if (currentSong._id === this.currentSong._id) {
  1351. const { likes, dislikes } = res.data;
  1352. this.updateCurrentSongRatings({ likes, dislikes });
  1353. }
  1354. }
  1355. );
  1356. if (this.loggedIn) {
  1357. this.socket.dispatch(
  1358. "songs.getOwnSongRatings",
  1359. currentSong.youtubeId,
  1360. res => {
  1361. console.log("getOwnSongRatings", res);
  1362. if (
  1363. res.status === "success" &&
  1364. this.currentSong.youtubeId ===
  1365. res.data.youtubeId
  1366. ) {
  1367. this.updateOwnCurrentSongRatings(res.data);
  1368. if (
  1369. this.autoSkipDisliked &&
  1370. res.data.disliked === true
  1371. ) {
  1372. this.voteSkipStation();
  1373. new Toast(
  1374. "Automatically voted to skip disliked song."
  1375. );
  1376. }
  1377. }
  1378. }
  1379. );
  1380. }
  1381. } else {
  1382. if (this.playerReady) this.player.pauseVideo();
  1383. this.updateNoSong(true);
  1384. }
  1385. this.calculateTimeElapsed();
  1386. this.resizeSeekerbar();
  1387. },
  1388. youtubeReady() {
  1389. if (!this.player) {
  1390. this.player = new window.YT.Player("stationPlayer", {
  1391. height: 270,
  1392. width: 480,
  1393. videoId: this.currentSong.youtubeId,
  1394. host: "https://www.youtube-nocookie.com",
  1395. startSeconds:
  1396. this.getTimeElapsed() / 1000 +
  1397. this.currentSong.skipDuration,
  1398. playerVars: {
  1399. controls: 0,
  1400. iv_load_policy: 3,
  1401. rel: 0,
  1402. showinfo: 0,
  1403. disablekb: 1,
  1404. playsinline: 1
  1405. },
  1406. events: {
  1407. onReady: () => {
  1408. this.playerReady = true;
  1409. let volume = parseInt(
  1410. localStorage.getItem("volume")
  1411. );
  1412. volume = typeof volume === "number" ? volume : 20;
  1413. this.player.setVolume(volume);
  1414. if (volume > 0) this.player.unMute();
  1415. if (this.muted) this.player.mute();
  1416. this.playVideo();
  1417. // on ios, playback will be forcibly paused locally
  1418. if (this.isApple) {
  1419. this.updateLocalPaused(true);
  1420. new Toast(
  1421. "Please click play manually to use Musare on iOS."
  1422. );
  1423. }
  1424. },
  1425. onError: err => {
  1426. console.log("error with youtube video", err);
  1427. if (err.data === 150 && this.loggedIn) {
  1428. new Toast(
  1429. "Automatically voted to skip as this song isn't available for you."
  1430. );
  1431. // automatically vote to skip
  1432. this.voteSkipStation();
  1433. // persistent message while song is playing
  1434. const persistentToast = new Toast({
  1435. content:
  1436. "This song is unavailable for you, but is playing for everyone else.",
  1437. persistent: true
  1438. });
  1439. // save current song id
  1440. const erroredYoutubeId =
  1441. this.currentSong.youtubeId;
  1442. this.persistentToasts.push({
  1443. toast: persistentToast,
  1444. checkIfCanRemove: () => {
  1445. if (
  1446. this.currentSong.youtubeId !==
  1447. erroredYoutubeId
  1448. ) {
  1449. persistentToast.destroy();
  1450. return true;
  1451. }
  1452. return false;
  1453. }
  1454. });
  1455. } else {
  1456. new Toast(
  1457. "There has been an error with the YouTube Embed"
  1458. );
  1459. }
  1460. },
  1461. onStateChange: event => {
  1462. if (
  1463. event.data === window.YT.PlayerState.PLAYING &&
  1464. this.videoLoading === true
  1465. ) {
  1466. this.videoLoading = false;
  1467. this.player.seekTo(
  1468. this.getTimeElapsed() / 1000 +
  1469. this.currentSong.skipDuration,
  1470. true
  1471. );
  1472. this.canAutoplay = true;
  1473. if (this.localPaused || this.stationPaused)
  1474. this.player.pauseVideo();
  1475. } else if (
  1476. event.data === window.YT.PlayerState.PLAYING &&
  1477. (this.localPaused || this.stationPaused)
  1478. ) {
  1479. this.player.seekTo(
  1480. this.timeBeforePause / 1000,
  1481. true
  1482. );
  1483. this.player.pauseVideo();
  1484. } else if (
  1485. event.data === window.YT.PlayerState.PLAYING &&
  1486. this.seeking === true
  1487. )
  1488. this.seeking = false;
  1489. if (
  1490. event.data === window.YT.PlayerState.PAUSED &&
  1491. !this.localPaused &&
  1492. !this.stationPaused &&
  1493. !this.noSong &&
  1494. this.player.getDuration() / 1000 <
  1495. this.currentSong.duration
  1496. ) {
  1497. this.player.seekTo(
  1498. this.getTimeElapsed() / 1000 +
  1499. this.currentSong.skipDuration,
  1500. true
  1501. );
  1502. this.player.playVideo();
  1503. }
  1504. }
  1505. }
  1506. });
  1507. }
  1508. },
  1509. getTimeElapsed() {
  1510. if (this.currentSong) {
  1511. let { timePaused } = this;
  1512. if (this.stationPaused)
  1513. timePaused += Date.currently() - this.pausedAt;
  1514. return Date.currently() - this.startedAt - timePaused;
  1515. }
  1516. return 0;
  1517. },
  1518. getTimeRemaining() {
  1519. if (this.currentSong) {
  1520. return this.currentSong.duration * 1000 - this.getTimeElapsed();
  1521. }
  1522. return 0;
  1523. },
  1524. playVideo() {
  1525. if (this.playerReady) {
  1526. this.videoLoading = true;
  1527. this.player.loadVideoById(
  1528. this.currentSong.youtubeId,
  1529. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  1530. );
  1531. if (window.stationInterval !== 0)
  1532. clearInterval(window.stationInterval);
  1533. window.stationInterval = setInterval(() => {
  1534. if (!this.stationPaused) {
  1535. this.resizeSeekerbar();
  1536. this.calculateTimeElapsed();
  1537. }
  1538. }, 150);
  1539. }
  1540. },
  1541. resizeSeekerbar() {
  1542. this.seekerbarPercentage = parseFloat(
  1543. (this.getTimeElapsed() / 1000 / this.currentSong.duration) * 100
  1544. );
  1545. },
  1546. calculateTimeElapsed() {
  1547. if (
  1548. this.playerReady &&
  1549. !this.noSong &&
  1550. this.currentSong &&
  1551. this.player.getPlayerState() === -1
  1552. ) {
  1553. if (!this.canAutoplay) {
  1554. if (
  1555. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  1556. 2000
  1557. ) {
  1558. this.lastTimeRequestedIfCanAutoplay = Date.now();
  1559. window.canAutoplay.video().then(({ result }) => {
  1560. if (result) {
  1561. this.attemptsToPlayVideo = 0;
  1562. this.canAutoplay = true;
  1563. } else {
  1564. this.canAutoplay = false;
  1565. }
  1566. });
  1567. }
  1568. } else {
  1569. this.player.playVideo();
  1570. this.attemptsToPlayVideo += 1;
  1571. }
  1572. }
  1573. if (
  1574. !this.stationPaused &&
  1575. !this.localPaused &&
  1576. this.playerReady &&
  1577. !this.isApple
  1578. ) {
  1579. const timeElapsed = this.getTimeElapsed();
  1580. const currentPlayerTime =
  1581. Math.max(
  1582. this.player.getCurrentTime() -
  1583. this.currentSong.skipDuration,
  1584. 0
  1585. ) * 1000;
  1586. const difference = timeElapsed - currentPlayerTime;
  1587. let playbackRate = 1;
  1588. if (difference < -2000) {
  1589. if (!this.seeking) {
  1590. this.seeking = true;
  1591. this.player.seekTo(
  1592. this.getTimeElapsed() / 1000 +
  1593. this.currentSong.skipDuration
  1594. );
  1595. }
  1596. } else if (difference < -200) {
  1597. playbackRate = 0.8;
  1598. } else if (difference < -50) {
  1599. playbackRate = 0.9;
  1600. } else if (difference < -25) {
  1601. playbackRate = 0.95;
  1602. } else if (difference > 2000) {
  1603. if (!this.seeking) {
  1604. this.seeking = true;
  1605. this.player.seekTo(
  1606. this.getTimeElapsed() / 1000 +
  1607. this.currentSong.skipDuration
  1608. );
  1609. }
  1610. } else if (difference > 200) {
  1611. playbackRate = 1.2;
  1612. } else if (difference > 50) {
  1613. playbackRate = 1.1;
  1614. } else if (difference > 25) {
  1615. playbackRate = 1.05;
  1616. } else if (this.player.getPlaybackRate !== 1.0) {
  1617. this.player.setPlaybackRate(1.0);
  1618. }
  1619. if (this.playbackRate !== playbackRate) {
  1620. this.player.setPlaybackRate(playbackRate);
  1621. this.playbackRate = playbackRate;
  1622. }
  1623. }
  1624. let { timePaused } = this;
  1625. if (this.stationPaused)
  1626. timePaused += Date.currently() - this.pausedAt;
  1627. const duration =
  1628. (Date.currently() - this.startedAt - timePaused) / 1000;
  1629. const songDuration = this.currentSong.duration;
  1630. if (songDuration <= duration) this.player.pauseVideo();
  1631. if (duration <= songDuration)
  1632. this.timeElapsed = utils.formatTime(duration);
  1633. },
  1634. toggleLock() {
  1635. window.socket.dispatch(
  1636. "stations.toggleLock",
  1637. this.station._id,
  1638. res => {
  1639. if (res.status === "success") {
  1640. new Toast("Successfully toggled the queue lock.");
  1641. } else new Toast(res.message);
  1642. }
  1643. );
  1644. },
  1645. changeVolume() {
  1646. const volume = this.volumeSliderValue;
  1647. localStorage.setItem("volume", volume / 100);
  1648. if (this.playerReady) {
  1649. this.player.setVolume(volume / 100);
  1650. if (volume > 0) {
  1651. this.player.unMute();
  1652. localStorage.setItem("muted", false);
  1653. this.muted = false;
  1654. }
  1655. }
  1656. },
  1657. resumeLocalStation() {
  1658. this.updateLocalPaused(false);
  1659. if (!this.stationPaused) this.resumeLocalPlayer();
  1660. },
  1661. pauseLocalStation() {
  1662. this.updateLocalPaused(true);
  1663. this.pauseLocalPlayer();
  1664. },
  1665. resumeLocalPlayer() {
  1666. if (!this.noSong) {
  1667. if (this.playerReady) {
  1668. this.player.seekTo(
  1669. this.getTimeElapsed() / 1000 +
  1670. this.currentSong.skipDuration
  1671. );
  1672. this.player.playVideo();
  1673. }
  1674. }
  1675. },
  1676. pauseLocalPlayer() {
  1677. if (!this.noSong) {
  1678. this.timeBeforePause = this.getTimeElapsed();
  1679. if (this.playerReady) this.player.pauseVideo();
  1680. }
  1681. },
  1682. skipStation() {
  1683. this.socket.dispatch(
  1684. "stations.forceSkip",
  1685. this.station._id,
  1686. data => {
  1687. if (data.status !== "success")
  1688. new Toast(`Error: ${data.message}`);
  1689. else
  1690. new Toast(
  1691. "Successfully skipped the station's current song."
  1692. );
  1693. }
  1694. );
  1695. },
  1696. voteSkipStation() {
  1697. this.socket.dispatch(
  1698. "stations.voteSkip",
  1699. this.station._id,
  1700. data => {
  1701. if (data.status !== "success")
  1702. new Toast(`Error: ${data.message}`);
  1703. else
  1704. new Toast(
  1705. "Successfully voted to skip the current song."
  1706. );
  1707. }
  1708. );
  1709. },
  1710. resumeStation() {
  1711. this.socket.dispatch("stations.resume", this.station._id, data => {
  1712. if (data.status !== "success")
  1713. new Toast(`Error: ${data.message}`);
  1714. else new Toast("Successfully resumed the station.");
  1715. });
  1716. },
  1717. pauseStation() {
  1718. this.socket.dispatch("stations.pause", this.station._id, data => {
  1719. if (data.status !== "success")
  1720. new Toast(`Error: ${data.message}`);
  1721. else new Toast("Successfully paused the station.");
  1722. });
  1723. },
  1724. toggleMute() {
  1725. if (this.playerReady) {
  1726. const previousVolume = parseFloat(
  1727. localStorage.getItem("volume")
  1728. );
  1729. const volume =
  1730. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  1731. this.muted = !this.muted;
  1732. localStorage.setItem("muted", this.muted);
  1733. this.volumeSliderValue = volume * 100;
  1734. this.player.setVolume(volume);
  1735. if (!this.muted) localStorage.setItem("volume", volume);
  1736. }
  1737. },
  1738. increaseVolume() {
  1739. if (this.playerReady) {
  1740. const previousVolume = parseInt(localStorage.getItem("volume"));
  1741. let volume = previousVolume + 5;
  1742. if (previousVolume === 0) {
  1743. this.muted = false;
  1744. localStorage.setItem("muted", false);
  1745. }
  1746. if (volume > 100) volume = 100;
  1747. this.volumeSliderValue = volume * 100;
  1748. this.player.setVolume(volume);
  1749. localStorage.setItem("volume", volume);
  1750. }
  1751. },
  1752. toggleLike() {
  1753. if (this.currentSong.liked)
  1754. this.socket.dispatch(
  1755. "songs.unlike",
  1756. this.currentSong.youtubeId,
  1757. res => {
  1758. if (res.status !== "success")
  1759. new Toast(`Error: ${res.message}`);
  1760. }
  1761. );
  1762. else
  1763. this.socket.dispatch(
  1764. "songs.like",
  1765. this.currentSong.youtubeId,
  1766. res => {
  1767. if (res.status !== "success")
  1768. new Toast(`Error: ${res.message}`);
  1769. }
  1770. );
  1771. },
  1772. toggleDislike() {
  1773. if (this.currentSong.disliked)
  1774. return this.socket.dispatch(
  1775. "songs.undislike",
  1776. this.currentSong.youtubeId,
  1777. res => {
  1778. if (res.status !== "success")
  1779. new Toast(`Error: ${res.message}`);
  1780. }
  1781. );
  1782. return this.socket.dispatch(
  1783. "songs.dislike",
  1784. this.currentSong.youtubeId,
  1785. res => {
  1786. if (res.status !== "success")
  1787. new Toast(`Error: ${res.message}`);
  1788. }
  1789. );
  1790. },
  1791. addPartyPlaylistSongToQueue() {
  1792. if (
  1793. !this.partyPlaylistLock &&
  1794. this.station.type === "community" &&
  1795. this.station.partyMode === true &&
  1796. this.songsList.length < 50 &&
  1797. this.currentUserQueueSongs < 3 &&
  1798. this.partyPlaylists.length > 0
  1799. ) {
  1800. const selectedPlaylist =
  1801. this.partyPlaylists[
  1802. Math.floor(Math.random() * this.partyPlaylists.length)
  1803. ];
  1804. if (selectedPlaylist._id && selectedPlaylist.songs.length > 0) {
  1805. const selectedSong =
  1806. selectedPlaylist.songs[
  1807. Math.floor(
  1808. Math.random() * selectedPlaylist.songs.length
  1809. )
  1810. ];
  1811. if (selectedSong.youtubeId) {
  1812. this.partyPlaylistLock = true;
  1813. this.socket.dispatch(
  1814. "stations.addToQueue",
  1815. this.station._id,
  1816. selectedSong.youtubeId,
  1817. data => {
  1818. this.partyPlaylistLock = false;
  1819. if (data.status !== "success")
  1820. this.addPartyPlaylistSongToQueue();
  1821. }
  1822. );
  1823. }
  1824. }
  1825. }
  1826. },
  1827. togglePlayerDebugBox() {
  1828. this.$refs.playerDebugBox.toggleBox();
  1829. },
  1830. resetPlayerDebugBox() {
  1831. this.$refs.playerDebugBox.resetBox();
  1832. },
  1833. toggleKeyboardShortcutsHelper() {
  1834. this.$refs.keyboardShortcutsHelper.toggleBox();
  1835. },
  1836. resetKeyboardShortcutsHelper() {
  1837. this.$refs.keyboardShortcutsHelper.resetBox();
  1838. },
  1839. join() {
  1840. this.socket.dispatch(
  1841. "stations.join",
  1842. this.stationIdentifier,
  1843. res => {
  1844. if (res.status === "success") {
  1845. setTimeout(() => {
  1846. this.loading = false;
  1847. }, 1000); // prevents popping in of youtube embed etc.
  1848. const {
  1849. _id,
  1850. displayName,
  1851. name,
  1852. description,
  1853. privacy,
  1854. locked,
  1855. partyMode,
  1856. owner,
  1857. privatePlaylist,
  1858. includedPlaylists,
  1859. excludedPlaylists,
  1860. type,
  1861. genres,
  1862. blacklistedGenres,
  1863. isFavorited,
  1864. theme
  1865. } = res.data;
  1866. // change url to use station name instead of station id
  1867. if (name !== this.stationIdentifier) {
  1868. // eslint-disable-next-line no-restricted-globals
  1869. this.$router.replace(name);
  1870. }
  1871. this.joinStation({
  1872. _id,
  1873. name,
  1874. displayName,
  1875. description,
  1876. privacy,
  1877. locked,
  1878. partyMode,
  1879. owner,
  1880. privatePlaylist,
  1881. includedPlaylists,
  1882. excludedPlaylists,
  1883. type,
  1884. genres,
  1885. blacklistedGenres,
  1886. isFavorited,
  1887. theme
  1888. });
  1889. document.body.style.cssText = `--primary-color: var(--${res.data.theme})`;
  1890. this.setCurrentSong({
  1891. currentSong: res.data.currentSong,
  1892. startedAt: res.data.startedAt,
  1893. paused: res.data.paused,
  1894. timePaused: res.data.timePaused,
  1895. pausedAt: res.data.pausedAt
  1896. });
  1897. this.updateUserCount(res.data.userCount);
  1898. this.updateUsers(res.data.users);
  1899. this.socket.dispatch(
  1900. "stations.getStationIncludedPlaylistsById",
  1901. this.station._id,
  1902. res => {
  1903. if (res.status === "success") {
  1904. this.setIncludedPlaylists(
  1905. res.data.playlists
  1906. );
  1907. }
  1908. }
  1909. );
  1910. this.socket.dispatch(
  1911. "stations.getStationExcludedPlaylistsById",
  1912. this.station._id,
  1913. res => {
  1914. if (res.status === "success") {
  1915. this.setExcludedPlaylists(
  1916. res.data.playlists
  1917. );
  1918. }
  1919. }
  1920. );
  1921. this.socket.dispatch("stations.getQueue", _id, res => {
  1922. if (res.status === "success") {
  1923. const { queue } = res.data;
  1924. this.updateSongsList(queue);
  1925. const [nextSong] = queue;
  1926. this.updateNextSong(nextSong);
  1927. }
  1928. });
  1929. if (this.isOwnerOrAdmin()) {
  1930. keyboardShortcuts.registerShortcut(
  1931. "station.pauseResume",
  1932. {
  1933. keyCode: 32, // Spacebar
  1934. shift: false,
  1935. ctrl: true,
  1936. preventDefault: true,
  1937. handler: () => {
  1938. if (this.aModalIsOpen) return;
  1939. if (this.stationPaused)
  1940. this.resumeStation();
  1941. else this.pauseStation();
  1942. }
  1943. }
  1944. );
  1945. keyboardShortcuts.registerShortcut(
  1946. "station.skipStation",
  1947. {
  1948. keyCode: 39, // Right arrow key
  1949. shift: false,
  1950. ctrl: true,
  1951. preventDefault: true,
  1952. handler: () => {
  1953. if (this.aModalIsOpen) return;
  1954. this.skipStation();
  1955. }
  1956. }
  1957. );
  1958. }
  1959. keyboardShortcuts.registerShortcut(
  1960. "station.lowerVolumeLarge",
  1961. {
  1962. keyCode: 40, // Down arrow key
  1963. shift: false,
  1964. ctrl: true,
  1965. preventDefault: true,
  1966. handler: () => {
  1967. if (this.aModalIsOpen) return;
  1968. this.volumeSliderValue -= 1000;
  1969. this.changeVolume();
  1970. }
  1971. }
  1972. );
  1973. keyboardShortcuts.registerShortcut(
  1974. "station.lowerVolumeSmall",
  1975. {
  1976. keyCode: 40, // Down arrow key
  1977. shift: true,
  1978. ctrl: true,
  1979. preventDefault: true,
  1980. handler: () => {
  1981. if (this.aModalIsOpen) return;
  1982. this.volumeSliderValue -= 100;
  1983. this.changeVolume();
  1984. }
  1985. }
  1986. );
  1987. keyboardShortcuts.registerShortcut(
  1988. "station.increaseVolumeLarge",
  1989. {
  1990. keyCode: 38, // Up arrow key
  1991. shift: false,
  1992. ctrl: true,
  1993. preventDefault: true,
  1994. handler: () => {
  1995. if (this.aModalIsOpen) return;
  1996. this.volumeSliderValue += 1000;
  1997. this.changeVolume();
  1998. }
  1999. }
  2000. );
  2001. keyboardShortcuts.registerShortcut(
  2002. "station.increaseVolumeSmall",
  2003. {
  2004. keyCode: 38, // Up arrow key
  2005. shift: true,
  2006. ctrl: true,
  2007. preventDefault: true,
  2008. handler: () => {
  2009. if (this.aModalIsOpen) return;
  2010. this.volumeSliderValue += 100;
  2011. this.changeVolume();
  2012. }
  2013. }
  2014. );
  2015. keyboardShortcuts.registerShortcut(
  2016. "station.toggleDebug",
  2017. {
  2018. keyCode: 68, // D key
  2019. shift: false,
  2020. ctrl: true,
  2021. preventDefault: true,
  2022. handler: () => {
  2023. if (this.aModalIsOpen) return;
  2024. this.togglePlayerDebugBox();
  2025. }
  2026. }
  2027. );
  2028. keyboardShortcuts.registerShortcut(
  2029. "station.toggleKeyboardShortcutsHelper",
  2030. {
  2031. keyCode: 191, // '/' key
  2032. ctrl: true,
  2033. preventDefault: true,
  2034. handler: () => {
  2035. if (this.aModalIsOpen) return;
  2036. this.toggleKeyboardShortcutsHelper();
  2037. }
  2038. }
  2039. );
  2040. keyboardShortcuts.registerShortcut(
  2041. "station.resetKeyboardShortcutsHelper",
  2042. {
  2043. keyCode: 191, // '/' key
  2044. ctrl: true,
  2045. shift: true,
  2046. preventDefault: true,
  2047. handler: () => {
  2048. if (this.aModalIsOpen) return;
  2049. this.resetKeyboardShortcutsHelper();
  2050. }
  2051. }
  2052. );
  2053. // UNIX client time before ping
  2054. const beforePing = Date.now();
  2055. this.socket.dispatch("apis.ping", res => {
  2056. if (res.status === "success") {
  2057. // UNIX client time after ping
  2058. const afterPing = Date.now();
  2059. // Average time in MS it took between the server responding and the client receiving
  2060. const connectionLatency =
  2061. (afterPing - beforePing) / 2;
  2062. console.log(
  2063. connectionLatency,
  2064. beforePing - afterPing
  2065. );
  2066. // UNIX server time
  2067. const serverDate = res.data.date;
  2068. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  2069. const difference =
  2070. serverDate + connectionLatency - afterPing;
  2071. console.log("Difference: ", difference);
  2072. if (difference > 3000 || difference < -3000) {
  2073. console.log(
  2074. "System time difference is bigger than 3 seconds."
  2075. );
  2076. }
  2077. this.systemDifference = difference;
  2078. }
  2079. });
  2080. } else {
  2081. this.loading = false;
  2082. this.exists = false;
  2083. }
  2084. }
  2085. );
  2086. },
  2087. favoriteStation() {
  2088. this.socket.dispatch(
  2089. "stations.favoriteStation",
  2090. this.station._id,
  2091. res => {
  2092. if (res.status === "success") {
  2093. new Toast("Successfully favorited station.");
  2094. } else new Toast(res.message);
  2095. }
  2096. );
  2097. },
  2098. unfavoriteStation() {
  2099. this.socket.dispatch(
  2100. "stations.unfavoriteStation",
  2101. this.station._id,
  2102. res => {
  2103. if (res.status === "success") {
  2104. new Toast("Successfully unfavorited station.");
  2105. } else new Toast(res.message);
  2106. }
  2107. );
  2108. },
  2109. sendActivityWatchVideoData() {
  2110. if (!this.stationPaused && !this.localPaused && !this.noSong) {
  2111. if (this.activityWatchVideoLastStatus !== "playing") {
  2112. this.activityWatchVideoLastStatus = "playing";
  2113. this.activityWatchVideoLastStartDuration =
  2114. this.currentSong.skipDuration + this.getTimeElapsed();
  2115. }
  2116. if (
  2117. this.activityWatchVideoLastYouTubeId !==
  2118. this.currentSong.youtubeId
  2119. ) {
  2120. this.activityWatchVideoLastYouTubeId =
  2121. this.currentSong.youtubeId;
  2122. this.activityWatchVideoLastStartDuration =
  2123. this.currentSong.skipDuration + this.getTimeElapsed();
  2124. }
  2125. const videoData = {
  2126. title: this.currentSong ? this.currentSong.title : null,
  2127. artists:
  2128. this.currentSong && this.currentSong.artists
  2129. ? this.currentSong.artists.join(", ")
  2130. : null,
  2131. youtubeId: this.currentSong.youtubeId,
  2132. muted: this.muted,
  2133. volume: this.volumeSliderValue / 100,
  2134. startedDuration:
  2135. this.activityWatchVideoLastStartDuration <= 0
  2136. ? 0
  2137. : Math.floor(
  2138. this.activityWatchVideoLastStartDuration /
  2139. 1000
  2140. ),
  2141. source: `station#${this.station.name}`,
  2142. hostname: window.location.hostname
  2143. };
  2144. aw.sendVideoData(videoData);
  2145. } else {
  2146. this.activityWatchVideoLastStatus = "not_playing";
  2147. }
  2148. },
  2149. ...mapActions("modalVisibility", ["openModal"]),
  2150. ...mapActions("station", [
  2151. "joinStation",
  2152. "leaveStation",
  2153. "updateUserCount",
  2154. "updateUsers",
  2155. "updateCurrentSong",
  2156. "updateNextSong",
  2157. "updateSongsList",
  2158. "repositionSongInList",
  2159. "updateStationPaused",
  2160. "updateLocalPaused",
  2161. "updateNoSong",
  2162. "updateIfStationIsFavorited",
  2163. "setIncludedPlaylists",
  2164. "setExcludedPlaylists",
  2165. "updateCurrentSongRatings",
  2166. "updateOwnCurrentSongRatings",
  2167. "updateCurrentSongSkipVotes"
  2168. ]),
  2169. ...mapActions("modals/editSong", ["stopVideo"])
  2170. }
  2171. };
  2172. </script>
  2173. <style lang="scss">
  2174. #stationPlayer {
  2175. position: absolute;
  2176. top: 0;
  2177. left: 0;
  2178. width: 100%;
  2179. height: 100%;
  2180. }
  2181. #currently-playing-container,
  2182. #next-up-container {
  2183. .song-item {
  2184. .thumbnail {
  2185. min-width: 130px;
  2186. width: 130px;
  2187. height: 130px;
  2188. }
  2189. }
  2190. }
  2191. </style>
  2192. <style lang="scss" scoped>
  2193. #page-loader-container {
  2194. height: inherit;
  2195. #page-loader-content {
  2196. height: inherit;
  2197. position: absolute;
  2198. max-width: 100%;
  2199. width: 1800px;
  2200. transform: translateX(-50%);
  2201. left: 50%;
  2202. }
  2203. #page-loader-layout {
  2204. height: inherit;
  2205. width: 100%;
  2206. }
  2207. }
  2208. #mobile-progress-animation {
  2209. width: 50px;
  2210. animation: rotate 0.8s infinite linear;
  2211. border: 8px solid var(--primary-color);
  2212. border-right-color: transparent;
  2213. border-radius: 50%;
  2214. height: 50px;
  2215. position: absolute;
  2216. top: 50%;
  2217. left: 50%;
  2218. display: none;
  2219. }
  2220. @keyframes rotate {
  2221. 0% {
  2222. transform: rotate(0deg);
  2223. }
  2224. 100% {
  2225. transform: rotate(360deg);
  2226. }
  2227. }
  2228. .nav,
  2229. .button.is-primary {
  2230. background-color: var(--primary-color) !important;
  2231. }
  2232. .button.is-primary:hover,
  2233. .button.is-primary:focus {
  2234. filter: brightness(90%);
  2235. }
  2236. .night-mode {
  2237. #currently-playing-container,
  2238. #next-up-container,
  2239. #about-station-container,
  2240. #control-bar-container,
  2241. .player-container {
  2242. background-color: var(--dark-grey-3) !important;
  2243. }
  2244. #video-container,
  2245. #control-bar-container,
  2246. .quadrant:not(#sidebar-container),
  2247. .player-container {
  2248. border: 0 !important;
  2249. }
  2250. #seeker-bar-container {
  2251. background-color: var(--dark-grey-3) !important;
  2252. }
  2253. #dropdown-toggle {
  2254. background-color: var(--dark-grey-2) !important;
  2255. border: 0;
  2256. i {
  2257. color: var(--white);
  2258. }
  2259. }
  2260. }
  2261. #station-outer-container {
  2262. margin: 0 auto;
  2263. padding: 20px 40px;
  2264. min-height: calc(100vh - 64px);
  2265. width: 100%;
  2266. max-width: 1800px;
  2267. display: flex;
  2268. #station-inner-container {
  2269. width: 100%;
  2270. min-height: calc(100vh - 428px);
  2271. display: flex;
  2272. flex-direction: row;
  2273. flex-wrap: wrap;
  2274. .row {
  2275. display: flex;
  2276. flex-direction: row;
  2277. max-width: 100%;
  2278. }
  2279. .column {
  2280. display: flex;
  2281. flex-direction: column;
  2282. }
  2283. .quadrant {
  2284. border-radius: 5px;
  2285. margin: 10px;
  2286. }
  2287. .quadrant:not(#sidebar-container) {
  2288. background-color: var(--white);
  2289. border: 1px solid var(--light-grey-3);
  2290. }
  2291. #station-left-column,
  2292. #station-right-column {
  2293. padding: 0;
  2294. }
  2295. #about-station-container {
  2296. padding: 20px;
  2297. display: flex;
  2298. flex-direction: column;
  2299. flex-grow: unset;
  2300. #station-info {
  2301. #station-name {
  2302. flex-direction: row !important;
  2303. h1 {
  2304. margin: 0;
  2305. font-size: 36px;
  2306. line-height: 0.8;
  2307. }
  2308. i {
  2309. margin-left: 10px;
  2310. font-size: 30px;
  2311. color: var(--yellow);
  2312. &.stationMode {
  2313. padding-left: 10px;
  2314. margin-left: auto;
  2315. color: var(--primary-color);
  2316. }
  2317. }
  2318. .verified-station {
  2319. color: var(--primary-color);
  2320. }
  2321. }
  2322. p {
  2323. max-width: 700px;
  2324. margin-bottom: 10px;
  2325. }
  2326. }
  2327. #admin-buttons {
  2328. display: flex;
  2329. .button {
  2330. margin: 3px;
  2331. }
  2332. }
  2333. }
  2334. #current-next-row {
  2335. display: flex;
  2336. flex-direction: row;
  2337. #currently-playing-container,
  2338. #next-up-container {
  2339. overflow: hidden;
  2340. flex-basis: 50%;
  2341. .song-item {
  2342. border: unset;
  2343. }
  2344. .nothing-here-text {
  2345. height: 100%;
  2346. }
  2347. }
  2348. > div:only-child {
  2349. flex: 1 !important;
  2350. flex-basis: 100% !important;
  2351. }
  2352. }
  2353. .player-container {
  2354. height: inherit;
  2355. background-color: var(--white);
  2356. display: flex;
  2357. flex-direction: column;
  2358. border: 1px solid var(--light-grey-3);
  2359. border-radius: 5px;
  2360. overflow: hidden;
  2361. &.nothing-here-text {
  2362. margin: 10px;
  2363. flex: 1;
  2364. min-height: 487px;
  2365. }
  2366. #video-container {
  2367. position: relative;
  2368. padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
  2369. height: 0;
  2370. overflow: hidden;
  2371. .player-cannot-autoplay {
  2372. position: relative;
  2373. width: 100%;
  2374. height: 100%;
  2375. bottom: calc(100% + 5px);
  2376. background: var(--primary-color);
  2377. display: flex;
  2378. align-items: center;
  2379. justify-content: center;
  2380. p {
  2381. color: var(--white);
  2382. font-size: 26px;
  2383. text-align: center;
  2384. }
  2385. }
  2386. }
  2387. #seeker-bar-container {
  2388. background-color: var(--white);
  2389. position: relative;
  2390. height: 7px;
  2391. display: block;
  2392. width: 100%;
  2393. #seeker-bar {
  2394. background-color: var(--primary-color);
  2395. top: 0;
  2396. left: 0;
  2397. bottom: 0;
  2398. position: absolute;
  2399. }
  2400. }
  2401. #control-bar-container {
  2402. display: flex;
  2403. justify-content: space-around;
  2404. padding: 10px 0;
  2405. width: 100%;
  2406. background: var(--white);
  2407. flex-direction: column;
  2408. flex-flow: wrap;
  2409. .button:not(#dropdown-toggle) {
  2410. width: 75px;
  2411. }
  2412. #left-buttons,
  2413. #right-buttons {
  2414. margin: 3px;
  2415. }
  2416. #left-buttons {
  2417. display: flex;
  2418. .button:not(:first-of-type) {
  2419. margin-left: 5px;
  2420. }
  2421. .disabled {
  2422. filter: grayscale(0.4);
  2423. }
  2424. }
  2425. #duration {
  2426. margin: 3px;
  2427. display: flex;
  2428. align-items: center;
  2429. p {
  2430. font-size: 22px;
  2431. /** prevents duration width slightly varying and shifting other controls slightly */
  2432. width: 150px;
  2433. text-align: center;
  2434. }
  2435. }
  2436. #volume-control {
  2437. margin: 3px;
  2438. margin-top: 0;
  2439. display: flex;
  2440. align-items: center;
  2441. cursor: pointer;
  2442. .volume-slider {
  2443. width: 100%;
  2444. padding: 0 15px;
  2445. background: transparent;
  2446. min-width: 100px;
  2447. }
  2448. input[type="range"] {
  2449. -webkit-appearance: none;
  2450. margin: 7.3px 0;
  2451. }
  2452. input[type="range"]:focus {
  2453. outline: none;
  2454. }
  2455. input[type="range"]::-webkit-slider-runnable-track {
  2456. width: 100%;
  2457. height: 5.2px;
  2458. cursor: pointer;
  2459. box-shadow: 0;
  2460. background: var(--light-grey-3);
  2461. border-radius: 0;
  2462. border: 0;
  2463. }
  2464. input[type="range"]::-webkit-slider-thumb {
  2465. box-shadow: 0;
  2466. border: 0;
  2467. height: 19px;
  2468. width: 19px;
  2469. border-radius: 15px;
  2470. background: var(--primary-color);
  2471. cursor: pointer;
  2472. -webkit-appearance: none;
  2473. margin-top: -6.5px;
  2474. }
  2475. input[type="range"]::-moz-range-track {
  2476. width: 100%;
  2477. height: 5.2px;
  2478. cursor: pointer;
  2479. box-shadow: 0;
  2480. background: var(--light-grey-3);
  2481. border-radius: 0;
  2482. border: 0;
  2483. }
  2484. input[type="range"]::-moz-range-thumb {
  2485. box-shadow: 0;
  2486. border: 0;
  2487. height: 19px;
  2488. width: 19px;
  2489. border-radius: 15px;
  2490. background: var(--primary-color);
  2491. cursor: pointer;
  2492. -webkit-appearance: none;
  2493. margin-top: -6.5px;
  2494. }
  2495. input[type="range"]::-ms-track {
  2496. width: 100%;
  2497. height: 5.2px;
  2498. cursor: pointer;
  2499. box-shadow: 0;
  2500. background: var(--light-grey-3);
  2501. border-radius: 1.3px;
  2502. }
  2503. input[type="range"]::-ms-fill-lower {
  2504. background: var(--light-grey-3);
  2505. border: 0;
  2506. border-radius: 0;
  2507. box-shadow: 0;
  2508. }
  2509. input[type="range"]::-ms-fill-upper {
  2510. background: var(--light-grey-3);
  2511. border: 0;
  2512. border-radius: 0;
  2513. box-shadow: 0;
  2514. }
  2515. input[type="range"]::-ms-thumb {
  2516. box-shadow: 0;
  2517. border: 0;
  2518. height: 15px;
  2519. width: 15px;
  2520. border-radius: 15px;
  2521. background: var(--primary-color);
  2522. cursor: pointer;
  2523. -webkit-appearance: none;
  2524. margin-top: 1.5px;
  2525. }
  2526. }
  2527. #right-buttons {
  2528. display: flex;
  2529. #dropdown-toggle {
  2530. width: 35px;
  2531. }
  2532. #dislike-song,
  2533. #add-song-to-playlist .button:not(#dropdown-toggle) {
  2534. margin-left: 5px;
  2535. }
  2536. #ratings {
  2537. display: flex;
  2538. &.liked #dislike-song,
  2539. &.disliked #like-song {
  2540. background-color: var(--grey) !important;
  2541. }
  2542. #like-song.disabled,
  2543. #dislike-song.disabled {
  2544. filter: grayscale(0.4);
  2545. }
  2546. }
  2547. #add-song-to-playlist {
  2548. display: flex;
  2549. flex-direction: column-reverse;
  2550. #nav-dropdown {
  2551. position: absolute;
  2552. margin-left: 4px;
  2553. margin-bottom: 36px;
  2554. .nav-dropdown-items {
  2555. position: relative;
  2556. right: calc(100% - 110px);
  2557. }
  2558. }
  2559. .control {
  2560. width: fit-content;
  2561. margin-bottom: 0 !important;
  2562. button.disabled {
  2563. filter: grayscale(0.4);
  2564. border-radius: 3px;
  2565. &::after {
  2566. margin-right: 100%;
  2567. }
  2568. }
  2569. }
  2570. }
  2571. }
  2572. }
  2573. }
  2574. #sidebar-container {
  2575. border-top: 0;
  2576. position: relative;
  2577. height: inherit;
  2578. flex-grow: 1;
  2579. min-height: 350px;
  2580. }
  2581. }
  2582. }
  2583. .footer {
  2584. margin-top: 30px;
  2585. }
  2586. .nyan {
  2587. background: linear-gradient(
  2588. 90deg,
  2589. magenta 0%,
  2590. red 15%,
  2591. orange 30%,
  2592. yellow 45%,
  2593. lime 60%,
  2594. cyan 75%,
  2595. blue 90%,
  2596. magenta 100%
  2597. );
  2598. background-size: 200%;
  2599. animation: nyanMoving 4s linear infinite;
  2600. }
  2601. @keyframes nyanMoving {
  2602. 0% {
  2603. background-position: 0% 0%;
  2604. }
  2605. 100% {
  2606. background-position: -200% 0%;
  2607. }
  2608. }
  2609. .bg-bubbles {
  2610. top: 0;
  2611. left: 0;
  2612. width: 100%;
  2613. height: 100%;
  2614. position: absolute;
  2615. z-index: -1;
  2616. margin: 0px;
  2617. pointer-events: none;
  2618. }
  2619. .bg-bubbles li {
  2620. position: absolute;
  2621. list-style: none;
  2622. display: block;
  2623. width: 40px;
  2624. height: 40px;
  2625. border-radius: 100px;
  2626. background-color: var(--primary-color);
  2627. opacity: 0.15;
  2628. bottom: 0px;
  2629. -webkit-animation: square 25s infinite;
  2630. animation: square 25s infinite;
  2631. -webkit-transition-timing-function: linear;
  2632. transition-timing-function: linear;
  2633. }
  2634. .bg-bubbles li:nth-child(1) {
  2635. left: 10%;
  2636. }
  2637. .bg-bubbles li:nth-child(2) {
  2638. left: 20%;
  2639. width: 80px;
  2640. height: 80px;
  2641. -webkit-animation-delay: 2s;
  2642. animation-delay: 2s;
  2643. -webkit-animation-duration: 17s;
  2644. animation-duration: 17s;
  2645. }
  2646. .bg-bubbles li:nth-child(3) {
  2647. left: 25%;
  2648. -webkit-animation-delay: 4s;
  2649. animation-delay: 4s;
  2650. }
  2651. .bg-bubbles li:nth-child(4) {
  2652. left: 40%;
  2653. width: 60px;
  2654. height: 60px;
  2655. -webkit-animation-duration: 22s;
  2656. animation-duration: 22s;
  2657. background-color: var(--primary-color);
  2658. opacity: 0.25;
  2659. }
  2660. .bg-bubbles li:nth-child(5) {
  2661. left: 70%;
  2662. }
  2663. .bg-bubbles li:nth-child(6) {
  2664. left: 80%;
  2665. width: 120px;
  2666. height: 120px;
  2667. -webkit-animation-delay: 3s;
  2668. animation-delay: 3s;
  2669. background-color: var(--primary-color);
  2670. opacity: 0.2;
  2671. }
  2672. .bg-bubbles li:nth-child(7) {
  2673. left: 32%;
  2674. width: 160px;
  2675. height: 160px;
  2676. -webkit-animation-delay: 7s;
  2677. animation-delay: 7s;
  2678. }
  2679. .bg-bubbles li:nth-child(8) {
  2680. left: 55%;
  2681. width: 20px;
  2682. height: 20px;
  2683. -webkit-animation-delay: 15s;
  2684. animation-delay: 15s;
  2685. -webkit-animation-duration: 40s;
  2686. animation-duration: 40s;
  2687. }
  2688. .bg-bubbles li:nth-child(9) {
  2689. left: 25%;
  2690. width: 10px;
  2691. height: 10px;
  2692. -webkit-animation-delay: 2s;
  2693. animation-delay: 2s;
  2694. -webkit-animation-duration: 40s;
  2695. animation-duration: 40s;
  2696. background-color: var(--primary-color);
  2697. opacity: 0.3;
  2698. }
  2699. .bg-bubbles li:nth-child(10) {
  2700. left: 80%;
  2701. width: 160px;
  2702. height: 160px;
  2703. -webkit-animation-delay: 11s;
  2704. animation-delay: 11s;
  2705. }
  2706. /* Tablet view fix */
  2707. @media (max-width: 768px) {
  2708. .bg-bubbles li:nth-child(10) {
  2709. display: none;
  2710. }
  2711. }
  2712. @-webkit-keyframes square {
  2713. 0% {
  2714. -webkit-transform: translateY(0);
  2715. transform: translateY(0);
  2716. }
  2717. 100% {
  2718. -webkit-transform: translateY(-700px) rotate(600deg);
  2719. transform: translateY(-700px) rotate(600deg);
  2720. }
  2721. }
  2722. @keyframes square {
  2723. 0% {
  2724. -webkit-transform: translateY(0);
  2725. transform: translateY(0);
  2726. }
  2727. 100% {
  2728. -webkit-transform: translateY(-700px) rotate(600deg);
  2729. transform: translateY(-700px) rotate(600deg);
  2730. }
  2731. }
  2732. /deep/ .nothing-here-text {
  2733. display: flex;
  2734. align-items: center;
  2735. justify-content: center;
  2736. }
  2737. @media (min-width: 1500px) {
  2738. #station-left-column {
  2739. max-width: 650px;
  2740. }
  2741. #station-right-column {
  2742. max-width: calc(100% - 650px);
  2743. }
  2744. }
  2745. @media (max-width: 1700px) {
  2746. #current-next-row {
  2747. flex-direction: column !important;
  2748. > div {
  2749. flex: 1 !important;
  2750. }
  2751. }
  2752. }
  2753. @media (max-width: 1500px) {
  2754. #mobile-progress-animation {
  2755. display: block;
  2756. }
  2757. #page-loader-container {
  2758. display: none;
  2759. }
  2760. #station-outer-container {
  2761. max-width: 1500px;
  2762. #station-inner-container {
  2763. flex-direction: row;
  2764. #station-left-column {
  2765. #about-station-container #admin-buttons {
  2766. flex-wrap: wrap;
  2767. }
  2768. #sidebar-container {
  2769. min-height: 350px;
  2770. }
  2771. }
  2772. #station-right-column {
  2773. #current-next-row {
  2774. flex-direction: column;
  2775. }
  2776. #control-bar-container {
  2777. #duration,
  2778. #volume-control,
  2779. #right-buttons,
  2780. #left-buttons {
  2781. margin-bottom: 5px;
  2782. justify-content: center;
  2783. }
  2784. #duration {
  2785. order: 1;
  2786. }
  2787. #volume-control {
  2788. order: 2;
  2789. max-width: 400px;
  2790. }
  2791. #right-buttons {
  2792. order: 3;
  2793. flex-wrap: wrap;
  2794. #ratings {
  2795. flex-wrap: wrap;
  2796. }
  2797. }
  2798. #left-buttons {
  2799. order: 4;
  2800. flex-wrap: wrap;
  2801. }
  2802. }
  2803. }
  2804. }
  2805. }
  2806. }
  2807. @media (max-width: 1200px) {
  2808. #station-outer-container {
  2809. max-width: 900px;
  2810. padding: 0;
  2811. #station-inner-container {
  2812. flex-direction: column-reverse;
  2813. flex-wrap: nowrap;
  2814. }
  2815. }
  2816. }
  2817. @media (max-width: 990px) {
  2818. #station-outer-container {
  2819. min-height: calc(
  2820. 100vh - 256px
  2821. ); // Height of nav (64px) + height of footer (190px)
  2822. }
  2823. }
  2824. </style>