Station.vue 42 KB

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