index.vue 60 KB

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