index.vue 62 KB

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