index.vue 61 KB

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