index.vue 72 KB

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