index.vue 62 KB

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