Station.vue 38 KB

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