Station.vue 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986
  1. <template>
  2. <div>
  3. <metadata
  4. v-if="exists && !loading"
  5. v-bind:title="`${station.displayName}`"
  6. />
  7. <metadata v-else-if="!exists && !loading" v-bind:title="`Not found`" />
  8. <station-header
  9. v-if="exists"
  10. :class="{ 'header-sidebar-active': sidebarActive }"
  11. />
  12. <div class="station-parent">
  13. <div v-show="loading" class="progress" />
  14. <div v-show="!loading && exists" class="station">
  15. <div v-show="noSong" class="no-song">
  16. <h1>No song is currently playing</h1>
  17. <h4
  18. v-if="
  19. station.type === 'community' &&
  20. station.partyMode &&
  21. this.loggedIn &&
  22. (!station.locked ||
  23. (station.locked &&
  24. this.userId === station.owner))
  25. "
  26. >
  27. <a
  28. href="#"
  29. class="no-song"
  30. @click="
  31. openModal({
  32. sector: 'station',
  33. modal: 'addSongToQueue'
  34. })
  35. "
  36. >Add a song to the queue</a
  37. >
  38. </h4>
  39. <h4
  40. v-if="
  41. station.type === 'community' &&
  42. !station.partyMode &&
  43. this.userId === station.owner &&
  44. !station.privatePlaylist
  45. "
  46. >
  47. <a
  48. href="#"
  49. class="no-song"
  50. @click="
  51. toggleSidebar({
  52. sector: 'station',
  53. sidebar: 'playlist'
  54. })
  55. "
  56. >Play a private playlist</a
  57. >
  58. </h4>
  59. <h1
  60. v-if="
  61. station.type === 'community' &&
  62. !station.partyMode &&
  63. this.userId === station.owner &&
  64. station.privatePlaylist
  65. "
  66. >
  67. Maybe you can add some songs to your selected private
  68. playlist and then press the skip button
  69. </h1>
  70. </div>
  71. <div v-show="!noSong" class="columns">
  72. <div
  73. class="column is-8-desktop is-offset-2-desktop is-12-mobile"
  74. >
  75. <div class="video-container">
  76. <div id="player" />
  77. <div
  78. class="player-can-not-autoplay"
  79. v-if="!canAutoplay"
  80. >
  81. <p>
  82. Please click anywhere on the screen for the
  83. video to start
  84. </p>
  85. </div>
  86. </div>
  87. <div
  88. id="preview-progress"
  89. class="seeker-bar-container white"
  90. >
  91. <div
  92. class="seeker-bar light-blue"
  93. style="width: 0%;"
  94. />
  95. </div>
  96. </div>
  97. <div
  98. class="desktop-only column is-3-desktop card playlistCard experimental"
  99. >
  100. <div v-if="station.type === 'community'" class="title">
  101. Queue
  102. </div>
  103. <div v-else class="title">
  104. Playlist
  105. </div>
  106. <article v-if="!noSong" class="media">
  107. <figure class="media-left">
  108. <p class="image is-64x64">
  109. <img
  110. :src="currentSong.thumbnail"
  111. onerror="this.src='/assets/notes-transparent.png'"
  112. />
  113. </p>
  114. </figure>
  115. <div class="media-content">
  116. <div class="content">
  117. <p>
  118. Current Song:
  119. <br />
  120. <strong>{{ currentSong.title }}</strong>
  121. <br />
  122. <small>{{ currentSong.artists }}</small>
  123. </p>
  124. </div>
  125. </div>
  126. <div class="media-right">
  127. {{ utils.formatTime(currentSong.duration) }}
  128. </div>
  129. </article>
  130. <p v-if="noSong" class="center">
  131. There is currently no song playing.
  132. </p>
  133. <article
  134. v-for="(song, index) in songsList"
  135. :key="index"
  136. class="media"
  137. >
  138. <div class="media-content">
  139. <div class="content">
  140. <strong class="songTitle">{{
  141. song.title
  142. }}</strong>
  143. <br />
  144. <small>{{ song.artists.join(", ") }}</small>
  145. <br />
  146. <div v-if="station.partyMode">
  147. <br />
  148. <small>
  149. Requested by
  150. <b>
  151. <user-id-to-username
  152. :userId="song.requestedBy"
  153. :link="true"
  154. />
  155. </b>
  156. </small>
  157. <button
  158. v-if="
  159. isOwnerOnly() || isAdminOnly()
  160. "
  161. class="button"
  162. @click="
  163. removeFromQueue(song.songId)
  164. "
  165. >
  166. REMOVE
  167. </button>
  168. </div>
  169. </div>
  170. </div>
  171. <div class="media-right">
  172. {{ utils.formatTime(song.duration) }}
  173. </div>
  174. </article>
  175. <a
  176. v-if="station.type === 'community' && loggedIn"
  177. class="button add-to-queue"
  178. href="#"
  179. @click="
  180. openModal({
  181. sector: 'station',
  182. modal: 'addSongToQueue'
  183. })
  184. "
  185. >Add a song to the queue</a
  186. >
  187. </div>
  188. </div>
  189. <div v-show="!noSong" class="desktop-only columns is-mobile">
  190. <div
  191. class="column is-8-desktop is-offset-2-desktop is-12-mobile"
  192. >
  193. <div class="columns is-mobile">
  194. <div class="column is-12-desktop">
  195. <h4 id="time-display">
  196. {{ timeElapsed }} /
  197. {{ utils.formatTime(currentSong.duration) }}
  198. </h4>
  199. <h3>{{ currentSong.title }}</h3>
  200. <h4 class="thin" style="margin-left: 0">
  201. {{ currentSong.artists }}
  202. </h4>
  203. <div class="columns is-mobile">
  204. <form
  205. style="margin-top: 12px; margin-bottom: 0;"
  206. action="#"
  207. class="column is-7-desktop is-4-mobile"
  208. >
  209. <p class="volume-slider-wrapper">
  210. <i
  211. v-if="muted"
  212. class="material-icons"
  213. @click="toggleMute()"
  214. >volume_mute</i
  215. >
  216. <i
  217. v-else
  218. class="material-icons"
  219. @click="toggleMute()"
  220. >volume_down</i
  221. >
  222. <input
  223. v-model="volumeSliderValue"
  224. type="range"
  225. min="0"
  226. max="10000"
  227. class="volumeSlider active"
  228. @change="changeVolume()"
  229. @input="changeVolume()"
  230. />
  231. <i
  232. class="material-icons"
  233. @click="increaseVolume()"
  234. >volume_up</i
  235. >
  236. </p>
  237. </form>
  238. <div
  239. class="column is-8-mobile is-5-desktop"
  240. >
  241. <ul
  242. v-if="
  243. currentSong.likes !== -1 &&
  244. currentSong.dislikes !== -1
  245. "
  246. id="ratings"
  247. >
  248. <li
  249. id="like"
  250. style="margin-right: 10px;"
  251. @click="toggleLike()"
  252. >
  253. <span class="flow-text">{{
  254. currentSong.likes
  255. }}</span>
  256. <i
  257. id="thumbs_up"
  258. class="material-icons grey-text"
  259. :class="{ liked: liked }"
  260. >thumb_up</i
  261. >
  262. <a
  263. class="absolute-a behind"
  264. href="#"
  265. @click="toggleLike()"
  266. />
  267. </li>
  268. <li
  269. id="dislike"
  270. @click="toggleDislike()"
  271. >
  272. <span class="flow-text">{{
  273. currentSong.dislikes
  274. }}</span>
  275. <i
  276. id="thumbs_down"
  277. class="material-icons grey-text"
  278. :class="{
  279. disliked: disliked
  280. }"
  281. >thumb_down</i
  282. >
  283. <a
  284. class="absolute-a behind"
  285. href="#"
  286. @click="toggleDislike()"
  287. />
  288. </li>
  289. </ul>
  290. </div>
  291. </div>
  292. </div>
  293. <div
  294. v-if="!currentSong.simpleSong"
  295. class="column is-3-desktop experimental"
  296. >
  297. <img
  298. class="image"
  299. :src="currentSong.thumbnail"
  300. alt="Song Thumbnail"
  301. onerror="this.src='/assets/notes-transparent.png'"
  302. />
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. <div v-show="!noSong" class="mobile-only">
  308. <div>
  309. <div>
  310. <div>
  311. <h3>{{ currentSong.title }}</h3>
  312. <h4 class="thin">
  313. {{ currentSong.artists }}
  314. </h4>
  315. <h5>
  316. {{ timeElapsed }} /
  317. {{ utils.formatTime(currentSong.duration) }}
  318. </h5>
  319. <div>
  320. <form class="columns" action="#">
  321. <p
  322. class="column is-11-mobile volume-slider-wrapper"
  323. >
  324. <i
  325. v-if="muted"
  326. class="material-icons"
  327. @click="toggleMute()"
  328. >volume_mute</i
  329. >
  330. <i
  331. v-else
  332. class="material-icons"
  333. @click="toggleMute()"
  334. >volume_down</i
  335. >
  336. <input
  337. v-model="volumeSliderValue"
  338. type="range"
  339. min="0"
  340. max="10000"
  341. class="active volumeSlider"
  342. @change="changeVolume()"
  343. @input="changeVolume()"
  344. />
  345. <i
  346. class="material-icons"
  347. @click="increaseVolume()"
  348. >volume_up</i
  349. >
  350. </p>
  351. </form>
  352. <div>
  353. <ul
  354. v-if="
  355. currentSong.likes !== -1 &&
  356. currentSong.dislikes !== -1
  357. "
  358. id="ratings"
  359. style="display: inline-block;"
  360. >
  361. <li
  362. id="dislike"
  363. style="display: inline-block;margin-right: 10px;"
  364. @click="toggleDislike()"
  365. >
  366. <span class="flow-text">{{
  367. currentSong.dislikes
  368. }}</span>
  369. <i
  370. id="thumbs_down"
  371. class="material-icons grey-text"
  372. :class="{
  373. disliked: disliked
  374. }"
  375. >thumb_down</i
  376. >
  377. <a
  378. class="absolute-a behind"
  379. href="#"
  380. @click="toggleDislike()"
  381. />
  382. </li>
  383. <li
  384. id="like"
  385. style="display: inline-block;"
  386. @click="toggleLike()"
  387. >
  388. <span class="flow-text">{{
  389. currentSong.likes
  390. }}</span>
  391. <i
  392. id="thumbs_up"
  393. class="material-icons grey-text"
  394. :class="{ liked: liked }"
  395. >thumb_up</i
  396. >
  397. <a
  398. class="absolute-a behind"
  399. href="#"
  400. @click="toggleLike()"
  401. />
  402. </li>
  403. </ul>
  404. </div>
  405. </div>
  406. </div>
  407. </div>
  408. </div>
  409. </div>
  410. </div>
  411. <song-queue v-if="modals.addSongToQueue" />
  412. <add-to-playlist v-if="modals.addSongToPlaylist" />
  413. <edit-playlist v-if="modals.editPlaylist" />
  414. <create-playlist v-if="modals.createPlaylist" />
  415. <edit-station v-show="modals.editStation" store="station" />
  416. <report v-if="modals.report" />
  417. <transition name="slide-outer">
  418. <div class="sidebar-container" v-if="sidebarActive">
  419. <transition name="slide-inner">
  420. <songs-list-sidebar v-if="sidebars.songslist" />
  421. </transition>
  422. <transition name="slide-inner">
  423. <playlist-sidebar v-if="sidebars.playlist" />
  424. </transition>
  425. <transition name="slide-inner">
  426. <users-sidebar v-if="sidebars.users" />
  427. </transition>
  428. </div>
  429. </transition>
  430. </div>
  431. <Z404 v-if="!exists"></Z404>
  432. </div>
  433. </template>
  434. <script>
  435. import { mapState, mapActions } from "vuex";
  436. import Toast from "toasters";
  437. import StationHeader from "./StationHeader.vue";
  438. import UserIdToUsername from "../UserIdToUsername.vue";
  439. import Z404 from "../404.vue";
  440. import io from "../../io";
  441. import keyboardShortcuts from "../../keyboardShortcuts";
  442. import utils from "../../js/utils";
  443. export default {
  444. data() {
  445. return {
  446. utils,
  447. title: "Station",
  448. loading: true,
  449. ready: false,
  450. exists: true,
  451. playerReady: false,
  452. player: undefined,
  453. timePaused: 0,
  454. muted: false,
  455. timeElapsed: "0:00",
  456. liked: false,
  457. disliked: false,
  458. timeBeforePause: 0,
  459. skipVotes: 0,
  460. automaticallyRequestedSongId: null,
  461. systemDifference: 0,
  462. attemptsToPlayVideo: 0,
  463. canAutoplay: true,
  464. lastTimeRequestedIfCanAutoplay: 0,
  465. seeking: false,
  466. playbackRate: 1,
  467. volumeSliderValue: 0
  468. };
  469. },
  470. computed: {
  471. ...mapState("modals", {
  472. modals: state => state.modals.station
  473. }),
  474. ...mapState("sidebars", {
  475. sidebars: state => state.sidebars.station
  476. }),
  477. ...mapState("station", {
  478. station: state => state.station,
  479. currentSong: state => state.currentSong,
  480. songsList: state => state.songsList,
  481. paused: state => state.paused,
  482. noSong: state => state.noSong,
  483. privatePlaylistQueueSelected: state =>
  484. state.privatePlaylistQueueSelected
  485. }),
  486. ...mapState({
  487. loggedIn: state => state.user.auth.loggedIn,
  488. userId: state => state.user.auth.userId,
  489. role: state => state.user.auth.role
  490. }),
  491. sidebarActive() {
  492. return Object.values(this.sidebars).indexOf(true) !== -1;
  493. }
  494. },
  495. methods: {
  496. isOwnerOnly() {
  497. return this.loggedIn && this.userId === this.station.owner;
  498. },
  499. isAdminOnly() {
  500. return this.loggedIn && this.role === "admin";
  501. },
  502. isOwnerOrAdmin() {
  503. return this.isOwnerOnly() || this.isAdminOnly();
  504. },
  505. removeFromQueue(songId) {
  506. window.socket.emit(
  507. "stations.removeFromQueue",
  508. this.station._id,
  509. songId,
  510. res => {
  511. if (res.status === "success") {
  512. new Toast({
  513. content:
  514. "Successfully removed song from the queue.",
  515. timeout: 4000
  516. });
  517. } else new Toast({ content: res.message, timeout: 8000 });
  518. }
  519. );
  520. },
  521. youtubeReady() {
  522. if (!this.player) {
  523. this.player = new window.YT.Player("player", {
  524. height: 270,
  525. width: 480,
  526. videoId: this.currentSong.songId,
  527. host: "https://www.youtube-nocookie.com",
  528. startSeconds:
  529. this.getTimeElapsed() / 1000 +
  530. this.currentSong.skipDuration,
  531. playerVars: {
  532. controls: 0,
  533. iv_load_policy: 3,
  534. rel: 0,
  535. showinfo: 0
  536. },
  537. events: {
  538. onReady: () => {
  539. this.playerReady = true;
  540. let volume = parseInt(
  541. localStorage.getItem("volume")
  542. );
  543. volume = typeof volume === "number" ? volume : 20;
  544. this.player.setVolume(volume);
  545. if (volume > 0) {
  546. this.player.unMute();
  547. }
  548. if (this.muted) this.player.mute();
  549. this.playVideo();
  550. },
  551. onError: err => {
  552. console.log("iframe error", err);
  553. this.voteSkipStation();
  554. },
  555. onStateChange: event => {
  556. if (
  557. event.data === window.YT.PlayerState.PLAYING &&
  558. this.videoLoading === true
  559. ) {
  560. this.videoLoading = false;
  561. this.player.seekTo(
  562. this.getTimeElapsed() / 1000 +
  563. this.currentSong.skipDuration,
  564. true
  565. );
  566. if (this.paused) this.player.pauseVideo();
  567. } else if (
  568. event.data === window.YT.PlayerState.PLAYING &&
  569. this.paused
  570. ) {
  571. this.player.seekTo(
  572. this.timeBeforePause / 1000,
  573. true
  574. );
  575. this.player.pauseVideo();
  576. } else if (
  577. event.data === window.YT.PlayerState.PLAYING &&
  578. this.seeking === true
  579. ) {
  580. this.seeking = false;
  581. }
  582. if (
  583. event.data === window.YT.PlayerState.PAUSED &&
  584. !this.paused &&
  585. !this.noSong &&
  586. this.player.getDuration() / 1000 <
  587. this.currentSong.duration
  588. ) {
  589. this.player.seekTo(
  590. this.getTimeElapsed() / 1000 +
  591. this.currentSong.skipDuration,
  592. true
  593. );
  594. this.player.playVideo();
  595. }
  596. }
  597. }
  598. });
  599. }
  600. },
  601. getTimeElapsed() {
  602. if (this.currentSong) {
  603. let { timePaused } = this;
  604. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  605. return Date.currently() - this.startedAt - timePaused;
  606. }
  607. return 0;
  608. },
  609. playVideo() {
  610. if (this.playerReady) {
  611. this.videoLoading = true;
  612. this.player.loadVideoById(
  613. this.currentSong.songId,
  614. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  615. );
  616. if (window.stationInterval !== 0)
  617. clearInterval(window.stationInterval);
  618. window.stationInterval = setInterval(() => {
  619. this.resizeSeekerbar();
  620. this.calculateTimeElapsed();
  621. }, 150);
  622. }
  623. },
  624. resizeSeekerbar() {
  625. if (!this.paused) {
  626. document.getElementsByClassName(
  627. "seeker-bar"
  628. )[0].style.width = `${parseFloat(
  629. (this.getTimeElapsed() / 1000 / this.currentSong.duration) *
  630. 100
  631. )}%`;
  632. }
  633. },
  634. calculateTimeElapsed() {
  635. if (
  636. this.playerReady &&
  637. this.currentSong &&
  638. this.player.getPlayerState() === -1
  639. ) {
  640. if (this.attemptsToPlayVideo >= 5) {
  641. if (
  642. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  643. 2000
  644. ) {
  645. this.lastTimeRequestedIfCanAutoplay = Date.now();
  646. window.canAutoplay.video().then(({ result }) => {
  647. if (result) {
  648. this.attemptsToPlayVideo = 0;
  649. this.canAutoplay = true;
  650. } else {
  651. this.canAutoplay = false;
  652. }
  653. });
  654. }
  655. } else {
  656. this.player.playVideo();
  657. this.attemptsToPlayVideo += 1;
  658. }
  659. }
  660. if (!this.paused) {
  661. const timeElapsed = this.getTimeElapsed();
  662. const currentPlayerTime = this.player.getCurrentTime() * 1000;
  663. const difference = timeElapsed - currentPlayerTime;
  664. // console.log(difference);
  665. let playbackRate = 1;
  666. if (difference < -2000) {
  667. if (!this.seeking) {
  668. this.seeking = true;
  669. this.player.seekTo(
  670. this.getTimeElapsed() / 1000 +
  671. this.currentSong.skipDuration
  672. );
  673. }
  674. } else if (difference < -200) {
  675. // console.log("Difference0.8");
  676. playbackRate = 0.8;
  677. } else if (difference < -50) {
  678. // console.log("Difference0.9");
  679. playbackRate = 0.9;
  680. } else if (difference < -25) {
  681. // console.log("Difference0.99");
  682. playbackRate = 0.95;
  683. } else if (difference > 2000) {
  684. if (!this.seeking) {
  685. this.seeking = true;
  686. this.player.seekTo(
  687. this.getTimeElapsed() / 1000 +
  688. this.currentSong.skipDuration
  689. );
  690. }
  691. } else if (difference > 200) {
  692. // console.log("Difference1.2");
  693. playbackRate = 1.2;
  694. } else if (difference > 50) {
  695. // console.log("Difference1.1");
  696. playbackRate = 1.1;
  697. } else if (difference > 25) {
  698. // console.log("Difference1.01");
  699. playbackRate = 1.05;
  700. } else if (this.player.getPlaybackRate !== 1.0) {
  701. // console.log("NDifference1.0");
  702. this.player.setPlaybackRate(1.0);
  703. }
  704. if (this.playbackRate !== playbackRate) {
  705. this.player.setPlaybackRate(playbackRate);
  706. this.playbackRate = playbackRate;
  707. }
  708. }
  709. /* if (this.currentTime !== undefined && this.paused) {
  710. this.timePaused += Date.currently() - this.currentTime;
  711. this.currentTime = undefined;
  712. } */
  713. let { timePaused } = this;
  714. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  715. const duration =
  716. (Date.currently() - this.startedAt - timePaused) / 1000;
  717. const songDuration = this.currentSong.duration;
  718. if (songDuration <= duration) this.player.pauseVideo();
  719. if (!this.paused && duration <= songDuration)
  720. this.timeElapsed = utils.formatTime(duration);
  721. },
  722. toggleLock() {
  723. window.socket.emit("stations.toggleLock", this.station._id, res => {
  724. if (res.status === "success") {
  725. new Toast({
  726. content: "Successfully toggled the queue lock.",
  727. timeout: 4000
  728. });
  729. } else new Toast({ content: res.message, timeout: 8000 });
  730. });
  731. },
  732. changeVolume() {
  733. const volume = this.volumeSliderValue;
  734. localStorage.setItem("volume", volume / 100);
  735. if (this.playerReady) {
  736. this.player.setVolume(volume / 100);
  737. if (volume > 0) {
  738. this.player.unMute();
  739. localStorage.setItem("muted", false);
  740. this.muted = false;
  741. }
  742. }
  743. },
  744. resumeLocalStation() {
  745. this.updatePaused(false);
  746. if (!this.noSong) {
  747. if (this.playerReady) {
  748. this.player.seekTo(
  749. this.getTimeElapsed() / 1000 +
  750. this.currentSong.skipDuration
  751. );
  752. this.player.playVideo();
  753. }
  754. }
  755. },
  756. pauseLocalStation() {
  757. this.updatePaused(true);
  758. if (!this.noSong) {
  759. this.timeBeforePause = this.getTimeElapsed();
  760. if (this.playerReady) this.player.pauseVideo();
  761. }
  762. },
  763. skipStation() {
  764. this.socket.emit("stations.forceSkip", this.station._id, data => {
  765. if (data.status !== "success")
  766. new Toast({
  767. content: `Error: ${data.message}`,
  768. timeout: 8000
  769. });
  770. else
  771. new Toast({
  772. content:
  773. "Successfully skipped the station's current song.",
  774. timeout: 4000
  775. });
  776. });
  777. },
  778. voteSkipStation() {
  779. this.socket.emit("stations.voteSkip", this.station._id, data => {
  780. if (data.status !== "success")
  781. new Toast({
  782. content: `Error: ${data.message}`,
  783. timeout: 8000
  784. });
  785. else
  786. new Toast({
  787. content: "Successfully voted to skip the current song.",
  788. timeout: 4000
  789. });
  790. });
  791. },
  792. resumeStation() {
  793. this.socket.emit("stations.resume", this.station._id, data => {
  794. if (data.status !== "success")
  795. new Toast({
  796. content: `Error: ${data.message}`,
  797. timeout: 8000
  798. });
  799. else
  800. new Toast({
  801. content: "Successfully resumed the station.",
  802. timeout: 4000
  803. });
  804. });
  805. },
  806. pauseStation() {
  807. this.socket.emit("stations.pause", this.station._id, data => {
  808. if (data.status !== "success")
  809. new Toast({
  810. content: `Error: ${data.message}`,
  811. timeout: 8000
  812. });
  813. else
  814. new Toast({
  815. content: "Successfully paused the station.",
  816. timeout: 4000
  817. });
  818. });
  819. },
  820. toggleMute() {
  821. if (this.playerReady) {
  822. const previousVolume = parseFloat(
  823. localStorage.getItem("volume")
  824. );
  825. const volume =
  826. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  827. this.muted = !this.muted;
  828. localStorage.setItem("muted", this.muted);
  829. this.volumeSliderValue = volume * 100;
  830. this.player.setVolume(volume);
  831. if (!this.muted) localStorage.setItem("volume", volume);
  832. }
  833. },
  834. increaseVolume() {
  835. if (this.playerReady) {
  836. const previousVolume = parseInt(localStorage.getItem("volume"));
  837. let volume = previousVolume + 5;
  838. if (previousVolume === 0) {
  839. this.muted = false;
  840. localStorage.setItem("muted", false);
  841. }
  842. if (volume > 100) volume = 100;
  843. this.volumeSliderValue = volume * 100;
  844. this.player.setVolume(volume);
  845. localStorage.setItem("volume", volume);
  846. }
  847. },
  848. toggleLike() {
  849. if (this.liked)
  850. this.socket.emit(
  851. "songs.unlike",
  852. this.currentSong.songId,
  853. data => {
  854. if (data.status !== "success")
  855. new Toast({
  856. content: `Error: ${data.message}`,
  857. timeout: 8000
  858. });
  859. }
  860. );
  861. else
  862. this.socket.emit(
  863. "songs.like",
  864. this.currentSong.songId,
  865. data => {
  866. if (data.status !== "success")
  867. new Toast({
  868. content: `Error: ${data.message}`,
  869. timeout: 8000
  870. });
  871. }
  872. );
  873. },
  874. toggleDislike() {
  875. if (this.disliked)
  876. return this.socket.emit(
  877. "songs.undislike",
  878. this.currentSong.songId,
  879. data => {
  880. if (data.status !== "success")
  881. new Toast({
  882. content: `Error: ${data.message}`,
  883. timeout: 8000
  884. });
  885. }
  886. );
  887. return this.socket.emit(
  888. "songs.dislike",
  889. this.currentSong.songId,
  890. data => {
  891. if (data.status !== "success")
  892. new Toast({
  893. content: `Error: ${data.message}`,
  894. timeout: 8000
  895. });
  896. }
  897. );
  898. },
  899. addFirstPrivatePlaylistSongToQueue() {
  900. let isInQueue = false;
  901. if (
  902. this.station.type === "community" &&
  903. this.station.partyMode === true
  904. ) {
  905. this.songsList.forEach(queueSong => {
  906. if (queueSong.requestedBy === this.userId) isInQueue = true;
  907. });
  908. if (!isInQueue && this.privatePlaylistQueueSelected) {
  909. this.socket.emit(
  910. "playlists.getFirstSong",
  911. this.privatePlaylistQueueSelected,
  912. data => {
  913. if (data.status === "success") {
  914. if (data.song) {
  915. if (data.song.duration < 15 * 60) {
  916. this.automaticallyRequestedSongId =
  917. data.song.songId;
  918. this.socket.emit(
  919. "stations.addToQueue",
  920. this.station._id,
  921. data.song.songId,
  922. data2 => {
  923. if (
  924. data2.status === "success"
  925. ) {
  926. this.socket.emit(
  927. "playlists.moveSongToBottom",
  928. this
  929. .privatePlaylistQueueSelected,
  930. data.song.songId,
  931. data3 => {
  932. if (
  933. data3.status ===
  934. "success"
  935. ) {} // eslint-disable-line
  936. }
  937. );
  938. }
  939. }
  940. );
  941. } else {
  942. new Toast({
  943. content: `Top song in playlist was too long to be added.`,
  944. timeout: 3000
  945. });
  946. this.socket.emit(
  947. "playlists.moveSongToBottom",
  948. this.privatePlaylistQueueSelected,
  949. data.song.songId,
  950. data3 => {
  951. if (
  952. data3.status === "success"
  953. ) {
  954. setTimeout(() => {
  955. this.addFirstPrivatePlaylistSongToQueue();
  956. }, 3000);
  957. }
  958. }
  959. );
  960. }
  961. } else {
  962. new Toast({
  963. content: `Selected playlist has no songs.`,
  964. timeout: 4000
  965. });
  966. }
  967. }
  968. }
  969. );
  970. }
  971. }
  972. },
  973. join() {
  974. this.socket.emit("stations.join", this.stationName, res => {
  975. if (res.status === "success") {
  976. this.loading = false;
  977. const {
  978. _id,
  979. displayName,
  980. description,
  981. privacy,
  982. locked,
  983. partyMode,
  984. owner,
  985. privatePlaylist,
  986. type
  987. } = res.data;
  988. this.joinStation({
  989. _id,
  990. name: this.stationName,
  991. displayName,
  992. description,
  993. privacy,
  994. locked,
  995. partyMode,
  996. owner,
  997. privatePlaylist,
  998. type
  999. });
  1000. const currentSong = res.data.currentSong
  1001. ? res.data.currentSong
  1002. : {};
  1003. if (currentSong.artists)
  1004. currentSong.artists = currentSong.artists.join(", ");
  1005. this.updateCurrentSong(currentSong);
  1006. this.startedAt = res.data.startedAt;
  1007. this.updatePaused(res.data.paused);
  1008. this.timePaused = res.data.timePaused;
  1009. this.updateUserCount(res.data.userCount);
  1010. this.updateUsers(res.data.users);
  1011. this.pausedAt = res.data.pausedAt;
  1012. if (res.data.currentSong) {
  1013. this.updateNoSong(false);
  1014. this.youtubeReady();
  1015. this.playVideo();
  1016. this.socket.emit(
  1017. "songs.getOwnSongRatings",
  1018. res.data.currentSong.songId,
  1019. data => {
  1020. if (this.currentSong.songId === data.songId) {
  1021. this.liked = data.liked;
  1022. this.disliked = data.disliked;
  1023. }
  1024. }
  1025. );
  1026. } else {
  1027. if (this.playerReady) this.player.pauseVideo();
  1028. this.updateNoSong(true);
  1029. }
  1030. if (type === "community" && partyMode === true) {
  1031. this.socket.emit("stations.getQueue", _id, res => {
  1032. if (res.status === "success") {
  1033. this.updateSongsList(res.queue);
  1034. }
  1035. });
  1036. }
  1037. if (this.isOwnerOrAdmin()) {
  1038. keyboardShortcuts.registerShortcut(
  1039. "station.pauseResume",
  1040. {
  1041. keyCode: 32,
  1042. shift: false,
  1043. ctrl: true,
  1044. handler: () => {
  1045. if (this.paused) this.resumeStation();
  1046. else this.pauseStation();
  1047. }
  1048. }
  1049. );
  1050. keyboardShortcuts.registerShortcut(
  1051. "station.skipStation",
  1052. {
  1053. keyCode: 39,
  1054. shift: false,
  1055. ctrl: true,
  1056. handler: () => {
  1057. this.skipStation();
  1058. }
  1059. }
  1060. );
  1061. }
  1062. keyboardShortcuts.registerShortcut(
  1063. "station.lowerVolumeLarge",
  1064. {
  1065. keyCode: 40,
  1066. shift: false,
  1067. ctrl: true,
  1068. handler: () => {
  1069. this.volumeSliderValue -= 1000;
  1070. this.changeVolume();
  1071. }
  1072. }
  1073. );
  1074. keyboardShortcuts.registerShortcut(
  1075. "station.lowerVolumeSmall",
  1076. {
  1077. keyCode: 40,
  1078. shift: true,
  1079. ctrl: true,
  1080. handler: () => {
  1081. this.volumeSliderValue -= 100;
  1082. this.changeVolume();
  1083. }
  1084. }
  1085. );
  1086. keyboardShortcuts.registerShortcut(
  1087. "station.increaseVolumeLarge",
  1088. {
  1089. keyCode: 38,
  1090. shift: false,
  1091. ctrl: true,
  1092. handler: () => {
  1093. this.volumeSliderValue += 1000;
  1094. this.changeVolume();
  1095. }
  1096. }
  1097. );
  1098. keyboardShortcuts.registerShortcut(
  1099. "station.increaseVolumeSmall",
  1100. {
  1101. keyCode: 38,
  1102. shift: true,
  1103. ctrl: true,
  1104. handler: () => {
  1105. this.volumeSliderValue += 100;
  1106. this.changeVolume();
  1107. }
  1108. }
  1109. );
  1110. // UNIX client time before ping
  1111. const beforePing = Date.now();
  1112. this.socket.emit("apis.ping", pong => {
  1113. // UNIX client time after ping
  1114. const afterPing = Date.now();
  1115. // Average time in MS it took between the server responding and the client receiving
  1116. const connectionLatency = (afterPing - beforePing) / 2;
  1117. console.log(connectionLatency, beforePing - afterPing);
  1118. // UNIX server time
  1119. const serverDate = pong.date;
  1120. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1121. const difference =
  1122. serverDate + connectionLatency - afterPing;
  1123. console.log("Difference: ", difference);
  1124. if (difference > 3000 || difference < -3000) {
  1125. console.log(
  1126. "System time difference is bigger than 3 seconds."
  1127. );
  1128. }
  1129. this.systemDifference = difference;
  1130. });
  1131. } else {
  1132. this.loading = false;
  1133. this.exists = false;
  1134. }
  1135. });
  1136. },
  1137. ...mapActions("sidebars", ["toggleSidebar"]),
  1138. ...mapActions("modals", ["openModal"]),
  1139. ...mapActions("station", [
  1140. "joinStation",
  1141. "updateUserCount",
  1142. "updateUsers",
  1143. "updateCurrentSong",
  1144. "updatePreviousSong",
  1145. "updateSongsList",
  1146. "updatePaused",
  1147. "updateNoSong"
  1148. ])
  1149. },
  1150. mounted() {
  1151. Date.currently = () => {
  1152. return new Date().getTime() + this.systemDifference;
  1153. };
  1154. this.stationName = this.$route.params.id;
  1155. window.stationInterval = 0;
  1156. io.getSocket(socket => {
  1157. this.socket = socket;
  1158. io.removeAllListeners();
  1159. if (this.socket.connected) this.join();
  1160. io.onConnect(this.join);
  1161. this.socket.emit("stations.existsByName", this.stationName, res => {
  1162. if (res.status === "failure" || !res.exists) {
  1163. this.loading = false;
  1164. this.exists = false;
  1165. }
  1166. });
  1167. this.socket.on("event:songs.next", data => {
  1168. const previousSong = this.currentSong.songId
  1169. ? this.currentSong
  1170. : null;
  1171. this.updatePreviousSong(previousSong);
  1172. this.updateCurrentSong(
  1173. data.currentSong ? data.currentSong : {}
  1174. );
  1175. this.startedAt = data.startedAt;
  1176. this.updatePaused(data.paused);
  1177. this.timePaused = data.timePaused;
  1178. if (data.currentSong) {
  1179. this.updateNoSong(false);
  1180. if (this.currentSong.artists)
  1181. this.currentSong.artists = this.currentSong.artists.join(
  1182. ", "
  1183. );
  1184. if (!this.playerReady) this.youtubeReady();
  1185. else this.playVideo();
  1186. this.socket.emit(
  1187. "songs.getOwnSongRatings",
  1188. data.currentSong.songId,
  1189. song => {
  1190. if (this.currentSong.songId === song.songId) {
  1191. this.liked = song.liked;
  1192. this.disliked = song.disliked;
  1193. }
  1194. }
  1195. );
  1196. } else {
  1197. if (this.playerReady) this.player.pauseVideo();
  1198. this.updateNoSong(true);
  1199. }
  1200. let isInQueue = false;
  1201. this.songsList.forEach(queueSong => {
  1202. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1203. });
  1204. if (
  1205. !isInQueue &&
  1206. this.privatePlaylistQueueSelected &&
  1207. (this.automaticallyRequestedSongId !==
  1208. this.currentSong.songId ||
  1209. !this.currentSong.songId)
  1210. ) {
  1211. this.addFirstPrivatePlaylistSongToQueue();
  1212. }
  1213. });
  1214. this.socket.on("event:stations.pause", data => {
  1215. this.pausedAt = data.pausedAt;
  1216. this.pauseLocalStation();
  1217. });
  1218. this.socket.on("event:stations.resume", data => {
  1219. this.timePaused = data.timePaused;
  1220. this.resumeLocalStation();
  1221. });
  1222. this.socket.on("event:stations.remove", () => {
  1223. window.location.href = "/";
  1224. return true;
  1225. });
  1226. this.socket.on("event:song.like", data => {
  1227. if (!this.noSong) {
  1228. if (data.songId === this.currentSong.songId) {
  1229. this.currentSong.dislikes = data.dislikes;
  1230. this.currentSong.likes = data.likes;
  1231. }
  1232. }
  1233. });
  1234. this.socket.on("event:song.dislike", data => {
  1235. if (!this.noSong) {
  1236. if (data.songId === this.currentSong.songId) {
  1237. this.currentSong.dislikes = data.dislikes;
  1238. this.currentSong.likes = data.likes;
  1239. }
  1240. }
  1241. });
  1242. this.socket.on("event:song.unlike", data => {
  1243. if (!this.noSong) {
  1244. if (data.songId === this.currentSong.songId) {
  1245. this.currentSong.dislikes = data.dislikes;
  1246. this.currentSong.likes = data.likes;
  1247. }
  1248. }
  1249. });
  1250. this.socket.on("event:song.undislike", data => {
  1251. if (!this.noSong) {
  1252. if (data.songId === this.currentSong.songId) {
  1253. this.currentSong.dislikes = data.dislikes;
  1254. this.currentSong.likes = data.likes;
  1255. }
  1256. }
  1257. });
  1258. this.socket.on("event:song.newRatings", data => {
  1259. if (!this.noSong) {
  1260. if (data.songId === this.currentSong.songId) {
  1261. this.liked = data.liked;
  1262. this.disliked = data.disliked;
  1263. }
  1264. }
  1265. });
  1266. this.socket.on("event:queue.update", queue => {
  1267. if (this.station.type === "community")
  1268. this.updateSongsList(queue);
  1269. });
  1270. this.socket.on("event:song.voteSkipSong", () => {
  1271. if (this.currentSong) this.currentSong.skipVotes += 1;
  1272. });
  1273. this.socket.on("event:privatePlaylist.selected", playlistId => {
  1274. if (this.station.type === "community") {
  1275. this.station.privatePlaylist = playlistId;
  1276. }
  1277. });
  1278. this.socket.on("event:partyMode.updated", partyMode => {
  1279. if (this.station.type === "community") {
  1280. this.station.partyMode = partyMode;
  1281. }
  1282. });
  1283. this.socket.on("event:newOfficialPlaylist", playlist => {
  1284. if (this.station.type === "official") {
  1285. this.updateSongsList(playlist);
  1286. }
  1287. });
  1288. this.socket.on("event:users.updated", users => {
  1289. this.updateUsers(users);
  1290. });
  1291. this.socket.on("event:userCount.updated", userCount => {
  1292. this.updateUserCount(userCount);
  1293. });
  1294. this.socket.on("event:queueLockToggled", locked => {
  1295. this.station.locked = locked;
  1296. });
  1297. });
  1298. if (JSON.parse(localStorage.getItem("muted"))) {
  1299. this.muted = true;
  1300. this.player.setVolume(0);
  1301. this.volumeSliderValue = 0 * 100;
  1302. } else {
  1303. let volume = parseFloat(localStorage.getItem("volume"));
  1304. volume =
  1305. typeof volume === "number" && !Number.isNaN(volume)
  1306. ? volume
  1307. : 20;
  1308. localStorage.setItem("volume", volume);
  1309. this.volumeSliderValue = volume * 100;
  1310. }
  1311. },
  1312. beforeDestroy() {
  1313. const shortcutNames = [
  1314. "station.pauseResume",
  1315. "station.skipStation",
  1316. "station.lowerVolumeLarge",
  1317. "station.lowerVolumeSmall",
  1318. "station.increaseVolumeLarge",
  1319. "station.increaseVolumeSmall"
  1320. ];
  1321. shortcutNames.forEach(shortcutName => {
  1322. keyboardShortcuts.unregisterShortcut(shortcutName);
  1323. });
  1324. },
  1325. components: {
  1326. StationHeader,
  1327. SongQueue: () => import("../Modals/AddSongToQueue.vue"),
  1328. AddToPlaylist: () => import("../Modals/AddSongToPlaylist.vue"),
  1329. EditPlaylist: () => import("../Modals/Playlists/Edit.vue"),
  1330. CreatePlaylist: () => import("../Modals/Playlists/Create.vue"),
  1331. EditStation: () => import("../Modals/EditStation.vue"),
  1332. Report: () => import("../Modals/Report.vue"),
  1333. SongsListSidebar: () => import("../Sidebars/SongsList.vue"),
  1334. PlaylistSidebar: () => import("../Sidebars/Playlist.vue"),
  1335. UsersSidebar: () => import("../Sidebars/UsersList.vue"),
  1336. UserIdToUsername,
  1337. Z404
  1338. }
  1339. };
  1340. </script>
  1341. <style lang="scss">
  1342. @import "styles/global.scss";
  1343. .station-parent {
  1344. display: flex;
  1345. flex: 1;
  1346. overflow-x: hidden;
  1347. }
  1348. .night-mode {
  1349. .nav,
  1350. .control-sidebar {
  1351. background-color: #222;
  1352. }
  1353. }
  1354. .player-can-not-autoplay {
  1355. position: absolute;
  1356. width: 100%;
  1357. height: 100%;
  1358. background: rgba(3, 169, 244, 0.95);
  1359. display: flex;
  1360. align-items: center;
  1361. justify-content: center;
  1362. p {
  1363. color: $white;
  1364. font-size: 26px;
  1365. text-align: center;
  1366. }
  1367. }
  1368. // Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
  1369. .slide-outer-enter {
  1370. margin-right: -300px;
  1371. }
  1372. // Active state for enter. Applied during the entire entering phase. Added before element is inserted, removed when transition/animation finishes. This class can be used to define the duration, delay and easing curve for the entering transition.
  1373. .slide-outer-enter-active {
  1374. transition: all 0.3s linear;
  1375. }
  1376. // Only available in versions 2.1.8+. Ending state for enter. Added one frame after element is inserted (at the same time v-enter is removed), removed when transition/animation finishes.
  1377. .slide-outer-enter-to {
  1378. margin-right: 0;
  1379. }
  1380. // Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
  1381. .slide-outer-leave {
  1382. margin-right: 0;
  1383. }
  1384. // Active state for leave. Applied during the entire leaving phase. Added immediately when leave transition is triggered, removed when the transition/animation finishes. This class can be used to define the duration, delay and easing curve for the leaving transition.
  1385. .slide-outer-leave-active {
  1386. transition: all 0.3s linear;
  1387. }
  1388. // Only available in versions 2.1.8+. Ending state for leave. Added one frame after a leaving transition is triggered (at the same time v-leave is removed), removed when the transition/animation finishes.
  1389. .slide-outer-leave-to {
  1390. margin-right: -300px;
  1391. }
  1392. // Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
  1393. .slide-inner-enter {
  1394. transform: translateX(300px);
  1395. }
  1396. // Active state for enter. Applied during the entire entering phase. Added before element is inserted, removed when transition/animation finishes. This class can be used to define the duration, delay and easing curve for the entering transition.
  1397. .slide-inner-enter-active {
  1398. transition: all 0.3s linear;
  1399. z-index: 5;
  1400. }
  1401. // Only available in versions 2.1.8+. Ending state for enter. Added one frame after element is inserted (at the same time v-enter is removed), removed when transition/animation finishes.
  1402. .slide-inner-enter-to {
  1403. transform: translateX(0px);
  1404. }
  1405. // Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
  1406. .slide-inner-leave {
  1407. transform: translateX(0px);
  1408. }
  1409. // Active state for leave. Applied during the entire leaving phase. Added immediately when leave transition is triggered, removed when the transition/animation finishes. This class can be used to define the duration, delay and easing curve for the leaving transition.
  1410. .slide-inner-leave-active {
  1411. transition: all 0.3s linear;
  1412. z-index: 0;
  1413. }
  1414. // Only available in versions 2.1.8+. Ending state for leave. Added one frame after a leaving transition is triggered (at the same time v-leave is removed), removed when the transition/animation finishes.
  1415. .slide-inner-leave-to {
  1416. transform: translateX(300px);
  1417. }
  1418. .sidebar-container {
  1419. width: 300px;
  1420. max-width: 300px;
  1421. // background-color: blue;
  1422. position: relative;
  1423. }
  1424. .sidebar {
  1425. position: absolute;
  1426. // z-index: 1;
  1427. top: 0;
  1428. right: 0;
  1429. width: 300px;
  1430. height: 100%;
  1431. background-color: $white;
  1432. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1433. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1434. }
  1435. .no-song {
  1436. color: $primary-color;
  1437. text-align: center;
  1438. }
  1439. .volumeSlider {
  1440. padding: 0 15px;
  1441. background: transparent;
  1442. }
  1443. .volume-slider-wrapper {
  1444. margin-top: 0;
  1445. position: relative;
  1446. display: flex;
  1447. align-items: center;
  1448. .material-icons {
  1449. user-select: none;
  1450. }
  1451. }
  1452. .material-icons {
  1453. cursor: pointer;
  1454. }
  1455. .stationDisplayName {
  1456. color: $white !important;
  1457. }
  1458. .add-to-playlist {
  1459. display: flex;
  1460. align-items: center;
  1461. justify-content: center;
  1462. }
  1463. // .slideout {
  1464. // top: 50px;
  1465. // height: 100%;
  1466. // position: fixed;
  1467. // right: 0;
  1468. // width: 350px;
  1469. // background-color: $white;
  1470. // box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1471. // 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1472. // .slideout-header {
  1473. // text-align: center;
  1474. // background-color: rgb(3, 169, 244) !important;
  1475. // margin: 0;
  1476. // padding-top: 5px;
  1477. // padding-bottom: 7px;
  1478. // color: $white;
  1479. // }
  1480. // .slideout-content {
  1481. // height: 100%;
  1482. // }
  1483. // }
  1484. .modal-large {
  1485. width: 75%;
  1486. }
  1487. .station {
  1488. padding-top: 0.5vw;
  1489. transition: all 0.1s;
  1490. margin: 0 auto;
  1491. flex: 0.9;
  1492. @media only screen and (min-width: 993px) {
  1493. flex: 0.7;
  1494. }
  1495. @media only screen and (min-width: 601px) {
  1496. flex: 0.85;
  1497. }
  1498. @media (min-width: 999px) {
  1499. .mobile-only {
  1500. display: none;
  1501. }
  1502. .desktop-only {
  1503. display: block;
  1504. }
  1505. }
  1506. @media (max-width: 998px) {
  1507. .mobile-only {
  1508. display: block;
  1509. }
  1510. .desktop-only {
  1511. display: none;
  1512. visibility: hidden;
  1513. }
  1514. }
  1515. .mobile-only {
  1516. text-align: center;
  1517. }
  1518. .playlistCard {
  1519. margin: 10px;
  1520. position: relative;
  1521. padding-bottom: calc(31.25% + 7px);
  1522. height: 0;
  1523. overflow-y: scroll;
  1524. .title {
  1525. background-color: rgb(3, 169, 244);
  1526. text-align: center;
  1527. padding: 10px;
  1528. color: $white;
  1529. font-weight: 600;
  1530. }
  1531. .media {
  1532. padding: 0 25px;
  1533. }
  1534. .media-content .content {
  1535. min-height: 64px;
  1536. max-height: 64px;
  1537. display: flex;
  1538. align-items: center;
  1539. }
  1540. .content p strong {
  1541. word-break: break-word;
  1542. }
  1543. .content p small {
  1544. word-break: break-word;
  1545. }
  1546. .add-to-queue {
  1547. width: 100%;
  1548. margin-top: 25px;
  1549. height: 40px;
  1550. border-radius: 0;
  1551. background: rgb(3, 169, 244);
  1552. color: $white !important;
  1553. border: 0;
  1554. &:active,
  1555. &:focus {
  1556. border: 0;
  1557. }
  1558. }
  1559. .add-to-queue:focus {
  1560. background: $primary-color;
  1561. }
  1562. .media-right {
  1563. line-height: 64px;
  1564. }
  1565. .songTitle {
  1566. word-wrap: break-word;
  1567. overflow: hidden;
  1568. text-overflow: ellipsis;
  1569. display: -webkit-box;
  1570. -webkit-box-orient: vertical;
  1571. -webkit-line-clamp: 2;
  1572. line-height: 20px;
  1573. max-height: 40px;
  1574. width: 100%;
  1575. }
  1576. }
  1577. input[type="range"] {
  1578. -webkit-appearance: none;
  1579. width: 100%;
  1580. margin: 7.3px 0;
  1581. }
  1582. input[type="range"]:focus {
  1583. outline: none;
  1584. }
  1585. input[type="range"]::-webkit-slider-runnable-track {
  1586. width: 100%;
  1587. height: 5.2px;
  1588. cursor: pointer;
  1589. box-shadow: 0;
  1590. background: $light-grey-2;
  1591. border-radius: 0;
  1592. border: 0;
  1593. }
  1594. input[type="range"]::-webkit-slider-thumb {
  1595. box-shadow: 0;
  1596. border: 0;
  1597. height: 19px;
  1598. width: 19px;
  1599. border-radius: 15px;
  1600. background: $primary-color;
  1601. cursor: pointer;
  1602. -webkit-appearance: none;
  1603. margin-top: -6.5px;
  1604. }
  1605. input[type="range"]::-moz-range-track {
  1606. width: 100%;
  1607. height: 5.2px;
  1608. cursor: pointer;
  1609. box-shadow: 0;
  1610. background: $light-grey-2;
  1611. border-radius: 0;
  1612. border: 0;
  1613. }
  1614. input[type="range"]::-moz-range-thumb {
  1615. box-shadow: 0;
  1616. border: 0;
  1617. height: 19px;
  1618. width: 19px;
  1619. border-radius: 15px;
  1620. background: $primary-color;
  1621. cursor: pointer;
  1622. -webkit-appearance: none;
  1623. margin-top: -6.5px;
  1624. }
  1625. input[type="range"]::-ms-track {
  1626. width: 100%;
  1627. height: 5.2px;
  1628. cursor: pointer;
  1629. box-shadow: 0;
  1630. background: $light-grey-2;
  1631. border-radius: 1.3px;
  1632. }
  1633. input[type="range"]::-ms-fill-lower {
  1634. background: $light-grey-2;
  1635. border: 0;
  1636. border-radius: 0;
  1637. box-shadow: 0;
  1638. }
  1639. input[type="range"]::-ms-fill-upper {
  1640. background: $light-grey-2;
  1641. border: 0;
  1642. border-radius: 0;
  1643. box-shadow: 0;
  1644. }
  1645. input[type="range"]::-ms-thumb {
  1646. box-shadow: 0;
  1647. border: 0;
  1648. height: 15px;
  1649. width: 15px;
  1650. border-radius: 15px;
  1651. background: $primary-color;
  1652. cursor: pointer;
  1653. -webkit-appearance: none;
  1654. margin-top: 1.5px;
  1655. }
  1656. .video-container {
  1657. position: relative;
  1658. padding-bottom: 56.25%;
  1659. height: 0;
  1660. overflow: hidden;
  1661. iframe {
  1662. position: absolute;
  1663. top: 0;
  1664. left: 0;
  1665. width: 100%;
  1666. height: 100%;
  1667. }
  1668. }
  1669. .video-col {
  1670. padding-right: 0.75rem;
  1671. padding-left: 0.75rem;
  1672. }
  1673. }
  1674. .room-title {
  1675. left: 50%;
  1676. -webkit-transform: translateX(-50%);
  1677. transform: translateX(-50%);
  1678. font-size: 2.1em;
  1679. }
  1680. #ratings {
  1681. display: flex;
  1682. justify-content: flex-end;
  1683. span {
  1684. font-size: 1.68rem;
  1685. }
  1686. i {
  1687. color: #9e9e9e !important;
  1688. cursor: pointer;
  1689. transition: 0.1s color;
  1690. }
  1691. }
  1692. #time-display {
  1693. margin-top: 30px;
  1694. float: right;
  1695. }
  1696. #thumbs_up:hover,
  1697. #thumbs_up.liked {
  1698. color: $green !important;
  1699. }
  1700. #thumbs_down:hover,
  1701. #thumbs_down.disliked {
  1702. color: $red !important;
  1703. }
  1704. #song-thumbnail {
  1705. max-width: 100%;
  1706. width: 85%;
  1707. }
  1708. .seeker-bar-container {
  1709. position: relative;
  1710. height: 7px;
  1711. display: block;
  1712. width: 100%;
  1713. overflow: hidden;
  1714. }
  1715. .seeker-bar {
  1716. top: 0;
  1717. left: 0;
  1718. bottom: 0;
  1719. position: absolute;
  1720. }
  1721. ul {
  1722. list-style: none;
  1723. margin: 0;
  1724. display: block;
  1725. }
  1726. h1,
  1727. h2,
  1728. h3,
  1729. h4,
  1730. h5,
  1731. h6 {
  1732. font-weight: 400;
  1733. line-height: 1.1;
  1734. }
  1735. h1 a,
  1736. h2 a,
  1737. h3 a,
  1738. h4 a,
  1739. h5 a,
  1740. h6 a {
  1741. font-weight: inherit;
  1742. }
  1743. h1 {
  1744. font-size: 4.2rem;
  1745. line-height: 110%;
  1746. margin: 2.1rem 0 1.68rem 0;
  1747. }
  1748. h2 {
  1749. font-size: 3.56rem;
  1750. line-height: 110%;
  1751. margin: 1.78rem 0 1.424rem 0;
  1752. }
  1753. h3 {
  1754. font-size: 2.92rem;
  1755. line-height: 110%;
  1756. margin: 1.46rem 0 1.168rem 0;
  1757. }
  1758. h4 {
  1759. font-size: 2.28rem;
  1760. line-height: 110%;
  1761. margin: 1.14rem 0 0.912rem 0;
  1762. }
  1763. h5 {
  1764. font-size: 1.64rem;
  1765. line-height: 110%;
  1766. margin: 0.82rem 0 0.656rem 0;
  1767. }
  1768. h6 {
  1769. font-size: 1rem;
  1770. line-height: 110%;
  1771. margin: 0.5rem 0 0.4rem 0;
  1772. }
  1773. .thin {
  1774. font-weight: 200;
  1775. }
  1776. .light-blue {
  1777. background-color: $primary-color !important;
  1778. }
  1779. .white {
  1780. background-color: $white !important;
  1781. }
  1782. .btn-search {
  1783. font-size: 14px;
  1784. }
  1785. .menu {
  1786. padding: 0 10px;
  1787. }
  1788. .menu-list li a:hover {
  1789. color: #000 !important;
  1790. }
  1791. .menu-list li {
  1792. display: flex;
  1793. justify-content: space-between;
  1794. }
  1795. .menu-list a {
  1796. /*padding: 0 10px !important;*/
  1797. }
  1798. .menu-list a:hover {
  1799. background-color: transparent;
  1800. }
  1801. .icons-group {
  1802. display: flex;
  1803. }
  1804. #like,
  1805. #dislike {
  1806. position: relative;
  1807. }
  1808. .behind {
  1809. z-index: -1;
  1810. }
  1811. .behind:focus {
  1812. z-index: 0;
  1813. }
  1814. .progress {
  1815. width: 50px;
  1816. animation: rotate 0.8s infinite linear;
  1817. border: 8px solid $primary-color;
  1818. border-right-color: transparent;
  1819. height: 50px;
  1820. position: absolute;
  1821. top: 50%;
  1822. left: 50%;
  1823. }
  1824. @keyframes rotate {
  1825. 0% {
  1826. transform: rotate(0deg);
  1827. }
  1828. 100% {
  1829. transform: rotate(360deg);
  1830. }
  1831. }
  1832. .experimental {
  1833. display: none !important;
  1834. }
  1835. </style>