index.vue 60 KB

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