index.vue 62 KB

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