index.vue 62 KB

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