index.vue 61 KB

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