index.vue 62 KB

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