index.vue 62 KB

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