index.vue 61 KB

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