index.vue 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621
  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. this.socket.on("event:privatePlaylist.deselected", () => {
  861. if (this.station.type === "community")
  862. this.station.privatePlaylist = null;
  863. });
  864. this.socket.on("event:partyMode.updated", res => {
  865. if (this.station.type === "community")
  866. this.station.partyMode = res.data.partyMode;
  867. });
  868. this.socket.on("event:station.themeUpdated", res => {
  869. const { theme } = res.data;
  870. this.station.theme = theme;
  871. document.body.style.cssText = `--primary-color: var(--${theme})`;
  872. });
  873. this.socket.on("event:station.updateName", res => {
  874. this.station.name = res.data.name;
  875. // eslint-disable-next-line no-restricted-globals
  876. history.pushState(
  877. {},
  878. null,
  879. `${res.data.name}?${Object.keys(this.$route.query)
  880. .map(key => {
  881. return `${encodeURIComponent(key)}=${encodeURIComponent(
  882. this.$route.query[key]
  883. )}`;
  884. })
  885. .join("&")}`
  886. );
  887. });
  888. this.socket.on("event:station.updateDisplayName", res => {
  889. this.station.displayName = res.data.displayName;
  890. });
  891. this.socket.on("event:station.updateDescription", res => {
  892. this.station.description = res.data.description;
  893. });
  894. // this.socket.on("event:newOfficialPlaylist", res => {
  895. // if (this.station.type === "official")
  896. // this.updateSongsList(res.data.playlist);
  897. // });
  898. this.socket.on("event:users.updated", res =>
  899. this.updateUsers(res.data.users)
  900. );
  901. this.socket.on("event:userCount.updated", res =>
  902. this.updateUserCount(res.data.userCount)
  903. );
  904. this.socket.on("event:queueLockToggled", res => {
  905. this.station.locked = res.data.locked;
  906. });
  907. this.socket.on("event:user.favoritedStation", res => {
  908. if (res.data.stationId === this.station._id)
  909. this.updateIfStationIsFavorited({ isFavorited: true });
  910. });
  911. this.socket.on("event:user.unfavoritedStation", res => {
  912. if (res.data.stationId === this.station._id)
  913. this.updateIfStationIsFavorited({ isFavorited: false });
  914. });
  915. if (JSON.parse(localStorage.getItem("muted"))) {
  916. this.muted = true;
  917. this.player.setVolume(0);
  918. this.volumeSliderValue = 0 * 100;
  919. } else {
  920. let volume = parseFloat(localStorage.getItem("volume"));
  921. volume =
  922. typeof volume === "number" && !Number.isNaN(volume)
  923. ? volume
  924. : 20;
  925. localStorage.setItem("volume", volume);
  926. this.volumeSliderValue = volume * 100;
  927. }
  928. },
  929. beforeDestroy() {
  930. document.body.style.cssText = "";
  931. /** Reset Songslist */
  932. this.updateSongsList([]);
  933. const shortcutNames = [
  934. "station.pauseResume",
  935. "station.skipStation",
  936. "station.lowerVolumeLarge",
  937. "station.lowerVolumeSmall",
  938. "station.increaseVolumeLarge",
  939. "station.increaseVolumeSmall",
  940. "station.toggleDebug"
  941. ];
  942. shortcutNames.forEach(shortcutName => {
  943. keyboardShortcuts.unregisterShortcut(shortcutName);
  944. });
  945. clearInterval(this.activityWatchVideoDataInterval);
  946. this.socket.dispatch("stations.leave", this.station._id, () => {});
  947. this.leaveStation();
  948. },
  949. methods: {
  950. isOwnerOnly() {
  951. return this.loggedIn && this.userId === this.station.owner;
  952. },
  953. isAdminOnly() {
  954. return this.loggedIn && this.role === "admin";
  955. },
  956. isOwnerOrAdmin() {
  957. return this.isOwnerOnly() || this.isAdminOnly();
  958. },
  959. removeFromQueue(youtubeId) {
  960. window.socket.dispatch(
  961. "stations.removeFromQueue",
  962. this.station._id,
  963. youtubeId,
  964. res => {
  965. if (res.status === "success") {
  966. new Toast("Successfully removed song from the queue.");
  967. } else new Toast(res.message);
  968. }
  969. );
  970. },
  971. youtubeReady() {
  972. if (!this.player) {
  973. this.player = new window.YT.Player("stationPlayer", {
  974. height: 270,
  975. width: 480,
  976. videoId: this.currentSong.youtubeId,
  977. host: "https://www.youtube-nocookie.com",
  978. startSeconds:
  979. this.getTimeElapsed() / 1000 +
  980. this.currentSong.skipDuration,
  981. playerVars: {
  982. controls: 0,
  983. iv_load_policy: 3,
  984. rel: 0,
  985. showinfo: 0,
  986. disablekb: 1
  987. },
  988. events: {
  989. onReady: () => {
  990. this.playerReady = true;
  991. let volume = parseInt(
  992. localStorage.getItem("volume")
  993. );
  994. volume = typeof volume === "number" ? volume : 20;
  995. this.player.setVolume(volume);
  996. if (volume > 0) this.player.unMute();
  997. if (this.muted) this.player.mute();
  998. this.playVideo();
  999. },
  1000. onError: err => {
  1001. console.log("error with youtube video", err);
  1002. if (err.data === 150 && this.loggedIn) {
  1003. new Toast(
  1004. "Automatically voted to skip as this song isn't available for you."
  1005. );
  1006. // automatically vote to skip
  1007. this.voteSkipStation();
  1008. // persistent message while song is playing
  1009. const persistentToast = new Toast({
  1010. content:
  1011. "This song is unavailable for you, but is playing for everyone else.",
  1012. persistent: true
  1013. });
  1014. // save current song id
  1015. const erroredYoutubeId = this.currentSong
  1016. .youtubeId;
  1017. // remove persistent toast if video has finished
  1018. window.isSongErroredInterval = setInterval(
  1019. () => {
  1020. if (
  1021. this.currentSong.youtubeId !==
  1022. erroredYoutubeId
  1023. ) {
  1024. persistentToast.destroy();
  1025. clearInterval(
  1026. window.isSongErroredInterval
  1027. );
  1028. }
  1029. },
  1030. 150
  1031. );
  1032. } else {
  1033. new Toast(
  1034. "There has been an error with the YouTube Embed"
  1035. );
  1036. }
  1037. },
  1038. onStateChange: event => {
  1039. if (
  1040. event.data === window.YT.PlayerState.PLAYING &&
  1041. this.videoLoading === true
  1042. ) {
  1043. this.videoLoading = false;
  1044. this.player.seekTo(
  1045. this.getTimeElapsed() / 1000 +
  1046. this.currentSong.skipDuration,
  1047. true
  1048. );
  1049. this.canAutoplay = true;
  1050. if (this.localPaused || this.stationPaused)
  1051. this.player.pauseVideo();
  1052. } else if (
  1053. event.data === window.YT.PlayerState.PLAYING &&
  1054. (this.localPaused || this.stationPaused)
  1055. ) {
  1056. this.player.seekTo(
  1057. this.timeBeforePause / 1000,
  1058. true
  1059. );
  1060. this.player.pauseVideo();
  1061. } else if (
  1062. event.data === window.YT.PlayerState.PLAYING &&
  1063. this.seeking === true
  1064. ) {
  1065. this.seeking = false;
  1066. }
  1067. if (
  1068. event.data === window.YT.PlayerState.PAUSED &&
  1069. !this.localPaused &&
  1070. !this.stationPaused &&
  1071. !this.noSong &&
  1072. this.player.getDuration() / 1000 <
  1073. this.currentSong.duration
  1074. ) {
  1075. this.player.seekTo(
  1076. this.getTimeElapsed() / 1000 +
  1077. this.currentSong.skipDuration,
  1078. true
  1079. );
  1080. this.player.playVideo();
  1081. }
  1082. }
  1083. }
  1084. });
  1085. }
  1086. },
  1087. getTimeElapsed() {
  1088. if (this.currentSong) {
  1089. let { timePaused } = this;
  1090. if (this.stationPaused)
  1091. timePaused += Date.currently() - this.pausedAt;
  1092. return Date.currently() - this.startedAt - timePaused;
  1093. }
  1094. return 0;
  1095. },
  1096. playVideo() {
  1097. if (this.playerReady) {
  1098. this.videoLoading = true;
  1099. this.player.loadVideoById(
  1100. this.currentSong.youtubeId,
  1101. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  1102. );
  1103. if (window.stationInterval !== 0)
  1104. clearInterval(window.stationInterval);
  1105. window.stationInterval = setInterval(() => {
  1106. this.resizeSeekerbar();
  1107. this.calculateTimeElapsed();
  1108. }, 150);
  1109. }
  1110. },
  1111. resizeSeekerbar() {
  1112. if (!this.stationPaused) {
  1113. this.seekerbarPercentage = parseFloat(
  1114. (this.getTimeElapsed() / 1000 / this.currentSong.duration) *
  1115. 100
  1116. );
  1117. }
  1118. },
  1119. calculateTimeElapsed() {
  1120. if (
  1121. this.playerReady &&
  1122. this.currentSong &&
  1123. this.player.getPlayerState() === -1
  1124. ) {
  1125. if (!this.canAutoplay) {
  1126. if (
  1127. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  1128. 2000
  1129. ) {
  1130. this.lastTimeRequestedIfCanAutoplay = Date.now();
  1131. window.canAutoplay.video().then(({ result }) => {
  1132. if (result) {
  1133. this.attemptsToPlayVideo = 0;
  1134. this.canAutoplay = true;
  1135. } else {
  1136. this.canAutoplay = false;
  1137. }
  1138. });
  1139. }
  1140. } else {
  1141. this.player.playVideo();
  1142. this.attemptsToPlayVideo += 1;
  1143. }
  1144. }
  1145. if (!this.stationPaused && !this.localPaused) {
  1146. const timeElapsed = this.getTimeElapsed();
  1147. const currentPlayerTime =
  1148. Math.max(
  1149. this.player.getCurrentTime() -
  1150. this.currentSong.skipDuration,
  1151. 0
  1152. ) * 1000;
  1153. const difference = timeElapsed - currentPlayerTime;
  1154. // console.log(difference);
  1155. let playbackRate = 1;
  1156. if (difference < -2000) {
  1157. if (!this.seeking) {
  1158. this.seeking = true;
  1159. this.player.seekTo(
  1160. this.getTimeElapsed() / 1000 +
  1161. this.currentSong.skipDuration
  1162. );
  1163. }
  1164. } else if (difference < -200) {
  1165. // console.log("Difference0.8");
  1166. playbackRate = 0.8;
  1167. } else if (difference < -50) {
  1168. // console.log("Difference0.9");
  1169. playbackRate = 0.9;
  1170. } else if (difference < -25) {
  1171. // console.log("Difference0.99");
  1172. playbackRate = 0.95;
  1173. } else if (difference > 2000) {
  1174. if (!this.seeking) {
  1175. this.seeking = true;
  1176. this.player.seekTo(
  1177. this.getTimeElapsed() / 1000 +
  1178. this.currentSong.skipDuration
  1179. );
  1180. }
  1181. } else if (difference > 200) {
  1182. // console.log("Difference1.2");
  1183. playbackRate = 1.2;
  1184. } else if (difference > 50) {
  1185. // console.log("Difference1.1");
  1186. playbackRate = 1.1;
  1187. } else if (difference > 25) {
  1188. // console.log("Difference1.01");
  1189. playbackRate = 1.05;
  1190. } else if (this.player.getPlaybackRate !== 1.0) {
  1191. // console.log("NDifference1.0");
  1192. this.player.setPlaybackRate(1.0);
  1193. }
  1194. if (this.playbackRate !== playbackRate) {
  1195. this.player.setPlaybackRate(playbackRate);
  1196. this.playbackRate = playbackRate;
  1197. }
  1198. }
  1199. /* if (this.currentTime !== undefined && this.paused) {
  1200. this.timePaused += Date.currently() - this.currentTime;
  1201. this.currentTime = undefined;
  1202. } */
  1203. let { timePaused } = this;
  1204. if (this.stationPaused)
  1205. timePaused += Date.currently() - this.pausedAt;
  1206. const duration =
  1207. (Date.currently() - this.startedAt - timePaused) / 1000;
  1208. const songDuration = this.currentSong.duration;
  1209. if (songDuration <= duration) this.player.pauseVideo();
  1210. if (!this.stationPaused && duration <= songDuration)
  1211. this.timeElapsed = utils.formatTime(duration);
  1212. },
  1213. toggleLock() {
  1214. window.socket.dispatch(
  1215. "stations.toggleLock",
  1216. this.station._id,
  1217. res => {
  1218. if (res.status === "success") {
  1219. new Toast("Successfully toggled the queue lock.");
  1220. } else new Toast(res.message);
  1221. }
  1222. );
  1223. },
  1224. changeVolume() {
  1225. const volume = this.volumeSliderValue;
  1226. localStorage.setItem("volume", volume / 100);
  1227. if (this.playerReady) {
  1228. this.player.setVolume(volume / 100);
  1229. if (volume > 0) {
  1230. this.player.unMute();
  1231. localStorage.setItem("muted", false);
  1232. this.muted = false;
  1233. }
  1234. }
  1235. },
  1236. resumeLocalStation() {
  1237. this.updateLocalPaused(false);
  1238. if (!this.stationPaused) this.resumeLocalPlayer();
  1239. },
  1240. pauseLocalStation() {
  1241. this.updateLocalPaused(true);
  1242. this.pauseLocalPlayer();
  1243. },
  1244. resumeLocalPlayer() {
  1245. if (!this.noSong) {
  1246. if (this.playerReady) {
  1247. this.player.seekTo(
  1248. this.getTimeElapsed() / 1000 +
  1249. this.currentSong.skipDuration
  1250. );
  1251. this.player.playVideo();
  1252. }
  1253. }
  1254. },
  1255. pauseLocalPlayer() {
  1256. if (!this.noSong) {
  1257. this.timeBeforePause = this.getTimeElapsed();
  1258. if (this.playerReady) this.player.pauseVideo();
  1259. }
  1260. },
  1261. skipStation() {
  1262. this.socket.dispatch(
  1263. "stations.forceSkip",
  1264. this.station._id,
  1265. data => {
  1266. if (data.status !== "success")
  1267. new Toast(`Error: ${data.message}`);
  1268. else
  1269. new Toast(
  1270. "Successfully skipped the station's current song."
  1271. );
  1272. }
  1273. );
  1274. },
  1275. voteSkipStation() {
  1276. this.socket.dispatch(
  1277. "stations.voteSkip",
  1278. this.station._id,
  1279. data => {
  1280. if (data.status !== "success")
  1281. new Toast(`Error: ${data.message}`);
  1282. else
  1283. new Toast(
  1284. "Successfully voted to skip the current song."
  1285. );
  1286. }
  1287. );
  1288. },
  1289. resumeStation() {
  1290. this.socket.dispatch("stations.resume", this.station._id, data => {
  1291. if (data.status !== "success")
  1292. new Toast(`Error: ${data.message}`);
  1293. else new Toast("Successfully resumed the station.");
  1294. });
  1295. },
  1296. pauseStation() {
  1297. this.socket.dispatch("stations.pause", this.station._id, data => {
  1298. if (data.status !== "success")
  1299. new Toast(`Error: ${data.message}`);
  1300. else new Toast("Successfully paused the station.");
  1301. });
  1302. },
  1303. toggleMute() {
  1304. if (this.playerReady) {
  1305. const previousVolume = parseFloat(
  1306. localStorage.getItem("volume")
  1307. );
  1308. const volume =
  1309. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  1310. this.muted = !this.muted;
  1311. localStorage.setItem("muted", this.muted);
  1312. this.volumeSliderValue = volume * 100;
  1313. this.player.setVolume(volume);
  1314. if (!this.muted) localStorage.setItem("volume", volume);
  1315. }
  1316. },
  1317. increaseVolume() {
  1318. if (this.playerReady) {
  1319. const previousVolume = parseInt(localStorage.getItem("volume"));
  1320. let volume = previousVolume + 5;
  1321. if (previousVolume === 0) {
  1322. this.muted = false;
  1323. localStorage.setItem("muted", false);
  1324. }
  1325. if (volume > 100) volume = 100;
  1326. this.volumeSliderValue = volume * 100;
  1327. this.player.setVolume(volume);
  1328. localStorage.setItem("volume", volume);
  1329. }
  1330. },
  1331. toggleLike() {
  1332. if (this.liked)
  1333. this.socket.dispatch(
  1334. "songs.unlike",
  1335. this.currentSong.youtubeId,
  1336. res => {
  1337. if (res.status !== "success")
  1338. new Toast(`Error: ${res.message}`);
  1339. }
  1340. );
  1341. else
  1342. this.socket.dispatch(
  1343. "songs.like",
  1344. this.currentSong.youtubeId,
  1345. res => {
  1346. if (res.status !== "success")
  1347. new Toast(`Error: ${res.message}`);
  1348. }
  1349. );
  1350. },
  1351. toggleDislike() {
  1352. if (this.disliked)
  1353. return this.socket.dispatch(
  1354. "songs.undislike",
  1355. this.currentSong.youtubeId,
  1356. res => {
  1357. if (res.status !== "success")
  1358. new Toast(`Error: ${res.message}`);
  1359. }
  1360. );
  1361. return this.socket.dispatch(
  1362. "songs.dislike",
  1363. this.currentSong.youtubeId,
  1364. res => {
  1365. if (res.status !== "success")
  1366. new Toast(`Error: ${res.message}`);
  1367. }
  1368. );
  1369. },
  1370. addPartyPlaylistSongToQueue() {
  1371. let isInQueue = false;
  1372. if (
  1373. this.station.type === "community" &&
  1374. this.station.partyMode === true
  1375. ) {
  1376. this.songsList.forEach(queueSong => {
  1377. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1378. });
  1379. if (!isInQueue && this.partyPlaylists.length > 0) {
  1380. const selectedPlaylist = this.partyPlaylists[
  1381. Math.floor(Math.random() * this.partyPlaylists.length)
  1382. ];
  1383. if (
  1384. selectedPlaylist._id &&
  1385. selectedPlaylist.songs.length > 0
  1386. ) {
  1387. const selectedSong =
  1388. selectedPlaylist.songs[
  1389. Math.floor(
  1390. Math.random() *
  1391. selectedPlaylist.songs.length
  1392. )
  1393. ];
  1394. if (selectedSong.youtubeId) {
  1395. this.socket.dispatch(
  1396. "stations.addToQueue",
  1397. this.station._id,
  1398. selectedSong.youtubeId,
  1399. data => {
  1400. if (data.status !== "success")
  1401. new Toast("Error auto queueing song");
  1402. }
  1403. );
  1404. }
  1405. }
  1406. }
  1407. }
  1408. },
  1409. togglePlayerDebugBox() {
  1410. this.$refs.playerDebugBox.toggleBox();
  1411. },
  1412. resetPlayerDebugBox() {
  1413. this.$refs.playerDebugBox.resetBox();
  1414. },
  1415. join() {
  1416. this.socket.dispatch(
  1417. "stations.join",
  1418. this.stationIdentifier,
  1419. res => {
  1420. if (res.status === "success") {
  1421. setTimeout(() => {
  1422. this.loading = false;
  1423. }, 1000); // prevents popping in of youtube embed etc.
  1424. const {
  1425. _id,
  1426. displayName,
  1427. name,
  1428. description,
  1429. privacy,
  1430. locked,
  1431. partyMode,
  1432. owner,
  1433. privatePlaylist,
  1434. includedPlaylists,
  1435. excludedPlaylists,
  1436. type,
  1437. genres,
  1438. blacklistedGenres,
  1439. isFavorited,
  1440. theme
  1441. } = res.data;
  1442. // change url to use station name instead of station id
  1443. if (name !== this.stationIdentifier) {
  1444. // eslint-disable-next-line no-restricted-globals
  1445. this.$router.replace(name);
  1446. }
  1447. this.joinStation({
  1448. _id,
  1449. name,
  1450. displayName,
  1451. description,
  1452. privacy,
  1453. locked,
  1454. partyMode,
  1455. owner,
  1456. privatePlaylist,
  1457. includedPlaylists,
  1458. excludedPlaylists,
  1459. type,
  1460. genres,
  1461. blacklistedGenres,
  1462. isFavorited,
  1463. theme
  1464. });
  1465. document.body.style.cssText = `--primary-color: var(--${res.data.theme})`;
  1466. const currentSong = res.data.currentSong
  1467. ? res.data.currentSong
  1468. : {};
  1469. this.updateCurrentSong(currentSong);
  1470. this.startedAt = res.data.startedAt;
  1471. this.updateStationPaused(res.data.paused);
  1472. this.timePaused = res.data.timePaused;
  1473. this.updateUserCount(res.data.userCount);
  1474. this.updateUsers(res.data.users);
  1475. this.pausedAt = res.data.pausedAt;
  1476. if (res.data.currentSong) {
  1477. this.updateNoSong(false);
  1478. this.youtubeReady();
  1479. this.playVideo();
  1480. this.socket.dispatch(
  1481. "songs.getOwnSongRatings",
  1482. res.data.currentSong.youtubeId,
  1483. res => {
  1484. if (
  1485. res.status === "success" &&
  1486. this.currentSong.youtubeId ===
  1487. res.data.youtubeId
  1488. ) {
  1489. this.liked = res.data.liked;
  1490. this.disliked = res.data.disliked;
  1491. }
  1492. }
  1493. );
  1494. } else {
  1495. if (this.playerReady) this.player.pauseVideo();
  1496. this.updateNoSong(true);
  1497. }
  1498. this.socket.dispatch(
  1499. "stations.getStationIncludedPlaylistsById",
  1500. this.station._id,
  1501. res => {
  1502. if (res.status === "success") {
  1503. this.setIncludedPlaylists(
  1504. res.data.playlists
  1505. );
  1506. }
  1507. }
  1508. );
  1509. this.socket.dispatch(
  1510. "stations.getStationExcludedPlaylistsById",
  1511. this.station._id,
  1512. res => {
  1513. if (res.status === "success") {
  1514. this.setExcludedPlaylists(
  1515. res.data.playlists
  1516. );
  1517. }
  1518. }
  1519. );
  1520. this.socket.dispatch("stations.getQueue", _id, res => {
  1521. if (res.status === "success") {
  1522. this.updateSongsList(res.data.queue);
  1523. let nextSong = null;
  1524. if (this.songsList[0]) {
  1525. nextSong = this.songsList[0].youtubeId
  1526. ? this.songsList[0]
  1527. : null;
  1528. }
  1529. this.updateNextSong(nextSong);
  1530. }
  1531. });
  1532. if (this.isOwnerOrAdmin()) {
  1533. keyboardShortcuts.registerShortcut(
  1534. "station.pauseResume",
  1535. {
  1536. keyCode: 32,
  1537. shift: false,
  1538. ctrl: true,
  1539. preventDefault: true,
  1540. handler: () => {
  1541. if (this.stationPaused)
  1542. this.resumeStation();
  1543. else this.pauseStation();
  1544. }
  1545. }
  1546. );
  1547. keyboardShortcuts.registerShortcut(
  1548. "station.skipStation",
  1549. {
  1550. keyCode: 39,
  1551. shift: false,
  1552. ctrl: true,
  1553. preventDefault: true,
  1554. handler: () => {
  1555. this.skipStation();
  1556. }
  1557. }
  1558. );
  1559. }
  1560. keyboardShortcuts.registerShortcut(
  1561. "station.lowerVolumeLarge",
  1562. {
  1563. keyCode: 40,
  1564. shift: false,
  1565. ctrl: true,
  1566. preventDefault: true,
  1567. handler: () => {
  1568. this.volumeSliderValue -= 1000;
  1569. this.changeVolume();
  1570. }
  1571. }
  1572. );
  1573. keyboardShortcuts.registerShortcut(
  1574. "station.lowerVolumeSmall",
  1575. {
  1576. keyCode: 40,
  1577. shift: true,
  1578. ctrl: true,
  1579. preventDefault: true,
  1580. handler: () => {
  1581. this.volumeSliderValue -= 100;
  1582. this.changeVolume();
  1583. }
  1584. }
  1585. );
  1586. keyboardShortcuts.registerShortcut(
  1587. "station.increaseVolumeLarge",
  1588. {
  1589. keyCode: 38,
  1590. shift: false,
  1591. ctrl: true,
  1592. preventDefault: true,
  1593. handler: () => {
  1594. this.volumeSliderValue += 1000;
  1595. this.changeVolume();
  1596. }
  1597. }
  1598. );
  1599. keyboardShortcuts.registerShortcut(
  1600. "station.increaseVolumeSmall",
  1601. {
  1602. keyCode: 38,
  1603. shift: true,
  1604. ctrl: true,
  1605. preventDefault: true,
  1606. handler: () => {
  1607. this.volumeSliderValue += 100;
  1608. this.changeVolume();
  1609. }
  1610. }
  1611. );
  1612. keyboardShortcuts.registerShortcut(
  1613. "station.toggleDebug",
  1614. {
  1615. keyCode: 68,
  1616. shift: false,
  1617. ctrl: true,
  1618. preventDefault: true,
  1619. handler: () => {
  1620. this.togglePlayerDebugBox();
  1621. }
  1622. }
  1623. );
  1624. // UNIX client time before ping
  1625. const beforePing = Date.now();
  1626. this.socket.dispatch("apis.ping", res => {
  1627. if (res.status === "success") {
  1628. // UNIX client time after ping
  1629. const afterPing = Date.now();
  1630. // Average time in MS it took between the server responding and the client receiving
  1631. const connectionLatency =
  1632. (afterPing - beforePing) / 2;
  1633. console.log(
  1634. connectionLatency,
  1635. beforePing - afterPing
  1636. );
  1637. // UNIX server time
  1638. const serverDate = res.data.date;
  1639. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1640. const difference =
  1641. serverDate + connectionLatency - afterPing;
  1642. console.log("Difference: ", difference);
  1643. if (difference > 3000 || difference < -3000) {
  1644. console.log(
  1645. "System time difference is bigger than 3 seconds."
  1646. );
  1647. }
  1648. this.systemDifference = difference;
  1649. }
  1650. });
  1651. } else {
  1652. this.loading = false;
  1653. this.exists = false;
  1654. }
  1655. }
  1656. );
  1657. },
  1658. favoriteStation() {
  1659. this.socket.dispatch(
  1660. "stations.favoriteStation",
  1661. this.station._id,
  1662. res => {
  1663. if (res.status === "success") {
  1664. new Toast("Successfully favorited station.");
  1665. } else new Toast(res.message);
  1666. }
  1667. );
  1668. },
  1669. unfavoriteStation() {
  1670. this.socket.dispatch(
  1671. "stations.unfavoriteStation",
  1672. this.station._id,
  1673. res => {
  1674. if (res.status === "success") {
  1675. new Toast("Successfully unfavorited station.");
  1676. } else new Toast(res.message);
  1677. }
  1678. );
  1679. },
  1680. sendActivityWatchVideoData() {
  1681. if (!this.stationPaused && !this.localPaused && this.currentSong) {
  1682. if (this.activityWatchVideoLastStatus !== "playing") {
  1683. this.activityWatchVideoLastStatus = "playing";
  1684. this.activityWatchVideoLastStartDuration =
  1685. this.currentSong.skipDuration + this.getTimeElapsed();
  1686. }
  1687. if (
  1688. this.activityWatchVideoLastYouTubeId !==
  1689. this.currentSong.youtubeId
  1690. ) {
  1691. this.activityWatchVideoLastYouTubeId = this.currentSong.youtubeId;
  1692. this.activityWatchVideoLastStartDuration =
  1693. this.currentSong.skipDuration + this.getTimeElapsed();
  1694. }
  1695. const videoData = {
  1696. title: this.currentSong ? this.currentSong.title : null,
  1697. artists:
  1698. this.currentSong && this.currentSong.artists
  1699. ? this.currentSong.artists.join(", ")
  1700. : null,
  1701. youtubeId: this.currentSong.youtubeId,
  1702. muted: this.muted,
  1703. volume: this.volumeSliderValue / 100,
  1704. startedDuration:
  1705. this.activityWatchVideoLastStartDuration <= 0
  1706. ? 0
  1707. : Math.floor(
  1708. this.activityWatchVideoLastStartDuration /
  1709. 1000
  1710. ),
  1711. source: `station#${this.station.name}`,
  1712. hostname: window.location.hostname
  1713. };
  1714. aw.sendVideoData(videoData);
  1715. } else {
  1716. this.activityWatchVideoLastStatus = "not_playing";
  1717. }
  1718. },
  1719. ...mapActions("modalVisibility", ["openModal"]),
  1720. ...mapActions("station", [
  1721. "joinStation",
  1722. "leaveStation",
  1723. "updateUserCount",
  1724. "updateUsers",
  1725. "updateCurrentSong",
  1726. "updatePreviousSong",
  1727. "updateNextSong",
  1728. "updateSongsList",
  1729. "repositionSongInList",
  1730. "updateStationPaused",
  1731. "updateLocalPaused",
  1732. "updateNoSong",
  1733. "updateIfStationIsFavorited",
  1734. "setIncludedPlaylists",
  1735. "setExcludedPlaylists"
  1736. ]),
  1737. ...mapActions("modals/editSong", ["stopVideo"])
  1738. }
  1739. };
  1740. </script>
  1741. <style lang="scss">
  1742. #stationPlayer {
  1743. position: absolute;
  1744. top: 0;
  1745. left: 0;
  1746. width: 100%;
  1747. height: 100%;
  1748. }
  1749. </style>
  1750. <style lang="scss" scoped>
  1751. #page-loader-container {
  1752. height: inherit;
  1753. #page-loader-content {
  1754. height: inherit;
  1755. position: absolute;
  1756. max-width: 100%;
  1757. width: 1800px;
  1758. transform: translateX(-50%);
  1759. left: 50%;
  1760. }
  1761. #page-loader-layout {
  1762. height: inherit;
  1763. width: 100%;
  1764. }
  1765. }
  1766. #mobile-progress-animation {
  1767. width: 50px;
  1768. animation: rotate 0.8s infinite linear;
  1769. border: 8px solid var(--primary-color);
  1770. border-right-color: transparent;
  1771. border-radius: 50%;
  1772. height: 50px;
  1773. position: absolute;
  1774. top: 50%;
  1775. left: 50%;
  1776. display: none;
  1777. }
  1778. @keyframes rotate {
  1779. 0% {
  1780. transform: rotate(0deg);
  1781. }
  1782. 100% {
  1783. transform: rotate(360deg);
  1784. }
  1785. }
  1786. .nav,
  1787. .button.is-primary {
  1788. background-color: var(--primary-color) !important;
  1789. }
  1790. .button.is-primary:hover,
  1791. .button.is-primary:focus {
  1792. filter: brightness(90%);
  1793. }
  1794. #player-debug-box {
  1795. .box-body {
  1796. flex-direction: column;
  1797. b {
  1798. color: var(--black);
  1799. }
  1800. }
  1801. }
  1802. .night-mode {
  1803. #currently-playing-container,
  1804. #next-up-container,
  1805. #about-station-container,
  1806. #control-bar-container,
  1807. .player-container {
  1808. background-color: var(--dark-grey-3) !important;
  1809. }
  1810. #video-container,
  1811. #control-bar-container,
  1812. .quadrant:not(#sidebar-container),
  1813. .player-container {
  1814. border: 0 !important;
  1815. }
  1816. #seeker-bar-container {
  1817. background-color: var(--dark-grey-3) !important;
  1818. }
  1819. #dropdown-toggle {
  1820. background-color: var(--dark-grey-2) !important;
  1821. border: 0;
  1822. i {
  1823. color: var(--white);
  1824. }
  1825. }
  1826. }
  1827. #station-outer-container {
  1828. margin: 0 auto;
  1829. padding: 20px 40px;
  1830. min-height: calc(100vh - 64px);
  1831. width: 100%;
  1832. max-width: 1800px;
  1833. display: flex;
  1834. #station-inner-container {
  1835. width: 100%;
  1836. // height: fit-content;
  1837. min-height: calc(100vh - 428px);
  1838. display: flex;
  1839. flex-direction: row;
  1840. flex-wrap: wrap;
  1841. .row {
  1842. display: flex;
  1843. flex-direction: row;
  1844. max-width: 100%;
  1845. }
  1846. .column {
  1847. display: flex;
  1848. flex-direction: column;
  1849. }
  1850. .quadrant {
  1851. border-radius: 5px;
  1852. margin: 10px;
  1853. }
  1854. .quadrant:not(#sidebar-container) {
  1855. background-color: var(--white);
  1856. border: 1px solid var(--light-grey-3);
  1857. }
  1858. #station-left-column,
  1859. #station-right-column {
  1860. padding: 0;
  1861. }
  1862. #about-station-container {
  1863. padding: 20px;
  1864. display: flex;
  1865. flex-direction: column;
  1866. flex-grow: unset;
  1867. #station-info {
  1868. #station-name {
  1869. flex-direction: row !important;
  1870. h1 {
  1871. margin: 0;
  1872. font-size: 36px;
  1873. line-height: 0.8;
  1874. }
  1875. i {
  1876. margin-left: 10px;
  1877. font-size: 30px;
  1878. color: var(--yellow);
  1879. &.stationMode {
  1880. padding-left: 10px;
  1881. margin-left: auto;
  1882. color: var(--primary-color);
  1883. }
  1884. }
  1885. }
  1886. p {
  1887. max-width: 700px;
  1888. margin-bottom: 10px;
  1889. }
  1890. }
  1891. #admin-buttons {
  1892. display: flex;
  1893. .button {
  1894. margin: 3px;
  1895. }
  1896. }
  1897. }
  1898. #current-next-row {
  1899. display: flex;
  1900. flex-direction: row;
  1901. // max-width: calc(100vw - 40px);
  1902. #currently-playing-container,
  1903. #next-up-container {
  1904. overflow: hidden;
  1905. flex-basis: 50%;
  1906. .song-item {
  1907. border: unset;
  1908. }
  1909. .nothing-here-text {
  1910. height: 100%;
  1911. }
  1912. }
  1913. > div:only-child {
  1914. flex: 1 !important;
  1915. flex-basis: 100% !important;
  1916. }
  1917. }
  1918. .player-container {
  1919. height: inherit;
  1920. background-color: var(--white);
  1921. display: flex;
  1922. flex-direction: column;
  1923. border: 1px solid var(--light-grey-3);
  1924. border-radius: 5px;
  1925. overflow: hidden;
  1926. &.nothing-here-text {
  1927. margin: 10px;
  1928. flex: 1;
  1929. min-height: 487px;
  1930. }
  1931. #video-container {
  1932. position: relative;
  1933. padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */
  1934. height: 0;
  1935. overflow: hidden;
  1936. .player-cannot-autoplay {
  1937. position: relative;
  1938. width: 100%;
  1939. height: 100%;
  1940. bottom: calc(100% + 5px);
  1941. background: var(--primary-color);
  1942. display: flex;
  1943. align-items: center;
  1944. justify-content: center;
  1945. p {
  1946. color: var(--white);
  1947. font-size: 26px;
  1948. text-align: center;
  1949. }
  1950. }
  1951. }
  1952. #seeker-bar-container {
  1953. background-color: var(--white);
  1954. position: relative;
  1955. height: 7px;
  1956. display: block;
  1957. width: 100%;
  1958. #seeker-bar {
  1959. background-color: var(--primary-color);
  1960. top: 0;
  1961. left: 0;
  1962. bottom: 0;
  1963. position: absolute;
  1964. }
  1965. }
  1966. #control-bar-container {
  1967. display: flex;
  1968. justify-content: space-around;
  1969. padding: 10px 0;
  1970. width: 100%;
  1971. background: var(--white);
  1972. flex-direction: column;
  1973. flex-flow: wrap;
  1974. .button:not(#dropdown-toggle) {
  1975. width: 75px;
  1976. }
  1977. #left-buttons,
  1978. #right-buttons {
  1979. margin: 3px;
  1980. }
  1981. #left-buttons {
  1982. display: flex;
  1983. .button:not(:first-of-type) {
  1984. margin-left: 5px;
  1985. }
  1986. .disabled {
  1987. filter: grayscale(0.4);
  1988. }
  1989. }
  1990. #duration {
  1991. margin: 3px;
  1992. display: flex;
  1993. align-items: center;
  1994. p {
  1995. font-size: 22px;
  1996. /** prevents duration width slightly varying and shifting other controls slightly */
  1997. width: 150px;
  1998. text-align: center;
  1999. }
  2000. }
  2001. #volume-control {
  2002. margin: 3px;
  2003. margin-top: 0;
  2004. display: flex;
  2005. align-items: center;
  2006. cursor: pointer;
  2007. .volume-slider {
  2008. width: 100%;
  2009. padding: 0 15px;
  2010. background: transparent;
  2011. min-width: 100px;
  2012. }
  2013. input[type="range"] {
  2014. -webkit-appearance: none;
  2015. margin: 7.3px 0;
  2016. }
  2017. input[type="range"]:focus {
  2018. outline: none;
  2019. }
  2020. input[type="range"]::-webkit-slider-runnable-track {
  2021. width: 100%;
  2022. height: 5.2px;
  2023. cursor: pointer;
  2024. box-shadow: 0;
  2025. background: var(--light-grey-3);
  2026. border-radius: 0;
  2027. border: 0;
  2028. }
  2029. input[type="range"]::-webkit-slider-thumb {
  2030. box-shadow: 0;
  2031. border: 0;
  2032. height: 19px;
  2033. width: 19px;
  2034. border-radius: 15px;
  2035. background: var(--primary-color);
  2036. cursor: pointer;
  2037. -webkit-appearance: none;
  2038. margin-top: -6.5px;
  2039. }
  2040. input[type="range"]::-moz-range-track {
  2041. width: 100%;
  2042. height: 5.2px;
  2043. cursor: pointer;
  2044. box-shadow: 0;
  2045. background: var(--light-grey-3);
  2046. border-radius: 0;
  2047. border: 0;
  2048. }
  2049. input[type="range"]::-moz-range-thumb {
  2050. box-shadow: 0;
  2051. border: 0;
  2052. height: 19px;
  2053. width: 19px;
  2054. border-radius: 15px;
  2055. background: var(--primary-color);
  2056. cursor: pointer;
  2057. -webkit-appearance: none;
  2058. margin-top: -6.5px;
  2059. }
  2060. input[type="range"]::-ms-track {
  2061. width: 100%;
  2062. height: 5.2px;
  2063. cursor: pointer;
  2064. box-shadow: 0;
  2065. background: var(--light-grey-3);
  2066. border-radius: 1.3px;
  2067. }
  2068. input[type="range"]::-ms-fill-lower {
  2069. background: var(--light-grey-3);
  2070. border: 0;
  2071. border-radius: 0;
  2072. box-shadow: 0;
  2073. }
  2074. input[type="range"]::-ms-fill-upper {
  2075. background: var(--light-grey-3);
  2076. border: 0;
  2077. border-radius: 0;
  2078. box-shadow: 0;
  2079. }
  2080. input[type="range"]::-ms-thumb {
  2081. box-shadow: 0;
  2082. border: 0;
  2083. height: 15px;
  2084. width: 15px;
  2085. border-radius: 15px;
  2086. background: var(--primary-color);
  2087. cursor: pointer;
  2088. -webkit-appearance: none;
  2089. margin-top: 1.5px;
  2090. }
  2091. }
  2092. #right-buttons {
  2093. display: flex;
  2094. #dropdown-toggle {
  2095. width: 35px;
  2096. }
  2097. #dislike-song,
  2098. #add-song-to-playlist .button:not(#dropdown-toggle) {
  2099. margin-left: 5px;
  2100. }
  2101. #ratings {
  2102. display: flex;
  2103. &.liked #dislike-song,
  2104. &.disliked #like-song {
  2105. background-color: var(--grey) !important;
  2106. }
  2107. #like-song.disabled,
  2108. #dislike-song.disabled {
  2109. filter: grayscale(0.4);
  2110. }
  2111. }
  2112. #add-song-to-playlist {
  2113. display: flex;
  2114. flex-direction: column-reverse;
  2115. #nav-dropdown {
  2116. position: absolute;
  2117. margin-left: 4px;
  2118. margin-bottom: 36px;
  2119. .nav-dropdown-items {
  2120. position: relative;
  2121. right: calc(100% - 110px);
  2122. }
  2123. }
  2124. .control {
  2125. width: fit-content;
  2126. margin-bottom: 0 !important;
  2127. button.disabled {
  2128. filter: grayscale(0.4);
  2129. border-radius: 3px;
  2130. &::after {
  2131. margin-right: 100%;
  2132. }
  2133. }
  2134. }
  2135. }
  2136. }
  2137. }
  2138. }
  2139. #sidebar-container {
  2140. border-top: 0;
  2141. position: relative;
  2142. height: inherit;
  2143. flex-grow: 1;
  2144. min-height: 350px;
  2145. }
  2146. }
  2147. }
  2148. .footer {
  2149. margin-top: 30px;
  2150. }
  2151. .nyan {
  2152. background: linear-gradient(
  2153. 90deg,
  2154. magenta 0%,
  2155. red 15%,
  2156. orange 30%,
  2157. yellow 45%,
  2158. lime 60%,
  2159. cyan 75%,
  2160. blue 90%,
  2161. magenta 100%
  2162. );
  2163. background-size: 200%;
  2164. animation: nyanMoving 4s linear infinite;
  2165. }
  2166. @keyframes nyanMoving {
  2167. 0% {
  2168. background-position: 0% 0%;
  2169. }
  2170. 100% {
  2171. background-position: -200% 0%;
  2172. }
  2173. }
  2174. .bg-bubbles {
  2175. top: 0;
  2176. left: 0;
  2177. width: 100%;
  2178. height: 100%;
  2179. position: absolute;
  2180. z-index: -1;
  2181. margin: 0px;
  2182. pointer-events: none;
  2183. }
  2184. .bg-bubbles li {
  2185. position: absolute;
  2186. list-style: none;
  2187. display: block;
  2188. width: 40px;
  2189. height: 40px;
  2190. border-radius: 100px;
  2191. // background-color: rgba(255, 255, 255, 0.15);
  2192. background-color: var(--primary-color);
  2193. opacity: 0.15;
  2194. bottom: 0px;
  2195. -webkit-animation: square 25s infinite;
  2196. animation: square 25s infinite;
  2197. -webkit-transition-timing-function: linear;
  2198. transition-timing-function: linear;
  2199. }
  2200. .bg-bubbles li:nth-child(1) {
  2201. left: 10%;
  2202. }
  2203. .bg-bubbles li:nth-child(2) {
  2204. left: 20%;
  2205. width: 80px;
  2206. height: 80px;
  2207. -webkit-animation-delay: 2s;
  2208. animation-delay: 2s;
  2209. -webkit-animation-duration: 17s;
  2210. animation-duration: 17s;
  2211. }
  2212. .bg-bubbles li:nth-child(3) {
  2213. left: 25%;
  2214. -webkit-animation-delay: 4s;
  2215. animation-delay: 4s;
  2216. }
  2217. .bg-bubbles li:nth-child(4) {
  2218. left: 40%;
  2219. width: 60px;
  2220. height: 60px;
  2221. -webkit-animation-duration: 22s;
  2222. animation-duration: 22s;
  2223. // background-color: rgba(255, 255, 255, 0.25);
  2224. background-color: var(--primary-color);
  2225. opacity: 0.25;
  2226. }
  2227. .bg-bubbles li:nth-child(5) {
  2228. left: 70%;
  2229. }
  2230. .bg-bubbles li:nth-child(6) {
  2231. left: 80%;
  2232. width: 120px;
  2233. height: 120px;
  2234. -webkit-animation-delay: 3s;
  2235. animation-delay: 3s;
  2236. // background-color: rgba(255, 255, 255, 0.2);
  2237. background-color: var(--primary-color);
  2238. opacity: 0.2;
  2239. }
  2240. .bg-bubbles li:nth-child(7) {
  2241. left: 32%;
  2242. width: 160px;
  2243. height: 160px;
  2244. -webkit-animation-delay: 7s;
  2245. animation-delay: 7s;
  2246. }
  2247. .bg-bubbles li:nth-child(8) {
  2248. left: 55%;
  2249. width: 20px;
  2250. height: 20px;
  2251. -webkit-animation-delay: 15s;
  2252. animation-delay: 15s;
  2253. -webkit-animation-duration: 40s;
  2254. animation-duration: 40s;
  2255. }
  2256. .bg-bubbles li:nth-child(9) {
  2257. left: 25%;
  2258. width: 10px;
  2259. height: 10px;
  2260. -webkit-animation-delay: 2s;
  2261. animation-delay: 2s;
  2262. -webkit-animation-duration: 40s;
  2263. animation-duration: 40s;
  2264. // background-color: rgba(255, 255, 255, 0.3);
  2265. background-color: var(--primary-color);
  2266. opacity: 0.3;
  2267. }
  2268. .bg-bubbles li:nth-child(10) {
  2269. left: 80%;
  2270. width: 160px;
  2271. height: 160px;
  2272. -webkit-animation-delay: 11s;
  2273. animation-delay: 11s;
  2274. }
  2275. /* Tablet view fix */
  2276. @media (max-width: 768px) {
  2277. .bg-bubbles li:nth-child(10) {
  2278. display: none;
  2279. }
  2280. }
  2281. @-webkit-keyframes square {
  2282. 0% {
  2283. -webkit-transform: translateY(0);
  2284. transform: translateY(0);
  2285. }
  2286. 100% {
  2287. -webkit-transform: translateY(-700px) rotate(600deg);
  2288. transform: translateY(-700px) rotate(600deg);
  2289. }
  2290. }
  2291. @keyframes square {
  2292. 0% {
  2293. -webkit-transform: translateY(0);
  2294. transform: translateY(0);
  2295. }
  2296. 100% {
  2297. -webkit-transform: translateY(-700px) rotate(600deg);
  2298. transform: translateY(-700px) rotate(600deg);
  2299. }
  2300. }
  2301. /deep/ .nothing-here-text {
  2302. display: flex;
  2303. align-items: center;
  2304. justify-content: center;
  2305. }
  2306. @media (min-width: 1500px) {
  2307. #station-left-column {
  2308. max-width: 650px;
  2309. }
  2310. #station-right-column {
  2311. max-width: calc(100% - 650px);
  2312. }
  2313. }
  2314. @media (max-width: 1700px) {
  2315. #current-next-row {
  2316. flex-direction: column !important;
  2317. > div {
  2318. flex: 1 !important;
  2319. }
  2320. }
  2321. }
  2322. @media (max-width: 1500px) {
  2323. #mobile-progress-animation {
  2324. display: block;
  2325. }
  2326. #page-loader-container {
  2327. display: none;
  2328. }
  2329. #station-outer-container {
  2330. max-width: 1500px;
  2331. #station-inner-container {
  2332. flex-direction: row;
  2333. #station-left-column {
  2334. #about-station-container #admin-buttons {
  2335. flex-wrap: wrap;
  2336. }
  2337. #sidebar-container {
  2338. min-height: 350px;
  2339. }
  2340. }
  2341. #station-right-column {
  2342. #current-next-row {
  2343. flex-direction: column;
  2344. }
  2345. #control-bar-container {
  2346. #duration,
  2347. #volume-control,
  2348. #right-buttons,
  2349. #left-buttons {
  2350. margin-bottom: 5px;
  2351. justify-content: center;
  2352. }
  2353. #duration {
  2354. order: 1;
  2355. }
  2356. #volume-control {
  2357. order: 2;
  2358. max-width: 400px;
  2359. }
  2360. #right-buttons {
  2361. order: 3;
  2362. flex-wrap: wrap;
  2363. #ratings {
  2364. flex-wrap: wrap;
  2365. }
  2366. }
  2367. #left-buttons {
  2368. order: 4;
  2369. flex-wrap: wrap;
  2370. }
  2371. }
  2372. }
  2373. }
  2374. }
  2375. }
  2376. @media (max-width: 1200px) {
  2377. #station-outer-container {
  2378. max-width: 900px;
  2379. padding: 0;
  2380. #station-inner-container {
  2381. flex-direction: column-reverse;
  2382. flex-wrap: nowrap;
  2383. }
  2384. }
  2385. }
  2386. @media (max-width: 990px) {
  2387. #station-outer-container {
  2388. min-height: calc(
  2389. 100vh - 256px
  2390. ); // Height of nav (64px) + height of footer (190px)
  2391. }
  2392. }
  2393. </style>