index.vue 60 KB

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