Station.vue 41 KB

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