index.vue 61 KB

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