Station.vue 39 KB

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