index.vue 62 KB

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