index.vue 61 KB

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