index.vue 60 KB

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