index.vue 73 KB

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