Station.vue 41 KB

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