Station.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935
  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(duration) {
  620. if (duration) {
  621. if (duration < 0) return "0:00";
  622. const hours = Math.floor(duration / (60 * 60));
  623. const minutes = Math.floor((duration - hours) / 60);
  624. const seconds = Math.floor(
  625. duration - hours * 60 * 60 - minutes * 60
  626. );
  627. const formatHours = () => {
  628. if (hours > 0) {
  629. if (hours < 10) return `0${hours}:`;
  630. return `${hours}:`;
  631. }
  632. return "";
  633. };
  634. return `${formatHours()}${minutes}:${
  635. seconds < 10 ? `0${seconds}` : seconds
  636. }`;
  637. }
  638. return false;
  639. },
  640. calculateTimeElapsed() {
  641. if (
  642. this.playerReady &&
  643. this.currentSong &&
  644. this.player.getPlayerState() === -1
  645. ) {
  646. if (this.attemptsToPlayVideo >= 5) {
  647. if (
  648. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  649. 2000
  650. ) {
  651. this.lastTimeRequestedIfCanAutoplay = Date.now();
  652. window.canAutoplay.video().then(({ result }) => {
  653. if (result) {
  654. this.attemptsToPlayVideo = 0;
  655. this.canAutoplay = true;
  656. } else {
  657. this.canAutoplay = false;
  658. }
  659. });
  660. }
  661. } else {
  662. this.player.playVideo();
  663. this.attemptsToPlayVideo += 1;
  664. }
  665. }
  666. if (!this.paused) {
  667. const timeElapsed = this.getTimeElapsed();
  668. const currentPlayerTime = this.player.getCurrentTime() * 1000;
  669. const difference = timeElapsed - currentPlayerTime;
  670. // console.log(difference);
  671. let playbackRate = 1;
  672. if (difference < -2000) {
  673. if (!this.seeking) {
  674. this.seeking = true;
  675. this.player.seekTo(
  676. this.getTimeElapsed() / 1000 +
  677. this.currentSong.skipDuration
  678. );
  679. }
  680. } else if (difference < -200) {
  681. // console.log("Difference0.8");
  682. playbackRate = 0.8;
  683. } else if (difference < -50) {
  684. // console.log("Difference0.9");
  685. playbackRate = 0.9;
  686. } else if (difference < -25) {
  687. // console.log("Difference0.99");
  688. playbackRate = 0.95;
  689. } else if (difference > 2000) {
  690. if (!this.seeking) {
  691. this.seeking = true;
  692. this.player.seekTo(
  693. this.getTimeElapsed() / 1000 +
  694. this.currentSong.skipDuration
  695. );
  696. }
  697. } else if (difference > 200) {
  698. // console.log("Difference1.2");
  699. playbackRate = 1.2;
  700. } else if (difference > 50) {
  701. // console.log("Difference1.1");
  702. playbackRate = 1.1;
  703. } else if (difference > 25) {
  704. // console.log("Difference1.01");
  705. playbackRate = 1.05;
  706. } else if (this.player.getPlaybackRate !== 1.0) {
  707. // console.log("NDifference1.0");
  708. this.player.setPlaybackRate(1.0);
  709. }
  710. if (this.playbackRate !== playbackRate) {
  711. this.player.setPlaybackRate(playbackRate);
  712. this.playbackRate = playbackRate;
  713. }
  714. }
  715. /* if (this.currentTime !== undefined && this.paused) {
  716. this.timePaused += Date.currently() - this.currentTime;
  717. this.currentTime = undefined;
  718. } */
  719. let { timePaused } = this;
  720. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  721. const duration =
  722. (Date.currently() - this.startedAt - timePaused) / 1000;
  723. const songDuration = this.currentSong.duration;
  724. if (songDuration <= duration) this.player.pauseVideo();
  725. if (!this.paused && duration <= songDuration)
  726. this.timeElapsed = this.formatTime(duration);
  727. },
  728. toggleLock() {
  729. window.socket.emit("stations.toggleLock", this.station._id, res => {
  730. if (res.status === "success") {
  731. new Toast({
  732. content: "Successfully toggled the queue lock.",
  733. timeout: 4000
  734. });
  735. } else new Toast({ content: res.message, timeout: 8000 });
  736. });
  737. },
  738. changeVolume() {
  739. const volume = document.getElementById("volumeSlider").value;
  740. localStorage.setItem("volume", volume / 100);
  741. if (this.playerReady) {
  742. this.player.setVolume(volume / 100);
  743. if (volume > 0) {
  744. this.player.unMute();
  745. localStorage.setItem("muted", false);
  746. this.muted = false;
  747. }
  748. }
  749. },
  750. resumeLocalStation() {
  751. this.updatePaused(false);
  752. if (!this.noSong) {
  753. if (this.playerReady) {
  754. this.player.seekTo(
  755. this.getTimeElapsed() / 1000 +
  756. this.currentSong.skipDuration
  757. );
  758. this.player.playVideo();
  759. }
  760. }
  761. },
  762. pauseLocalStation() {
  763. this.updatePaused(true);
  764. if (!this.noSong) {
  765. this.timeBeforePause = this.getTimeElapsed();
  766. if (this.playerReady) this.player.pauseVideo();
  767. }
  768. },
  769. skipStation() {
  770. this.socket.emit("stations.forceSkip", this.station._id, data => {
  771. if (data.status !== "success")
  772. new Toast({
  773. content: `Error: ${data.message}`,
  774. timeout: 8000
  775. });
  776. else
  777. new Toast({
  778. content:
  779. "Successfully skipped the station's current song.",
  780. timeout: 4000
  781. });
  782. });
  783. },
  784. voteSkipStation() {
  785. this.socket.emit("stations.voteSkip", 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 voted to skip the current song.",
  794. timeout: 4000
  795. });
  796. });
  797. },
  798. resumeStation() {
  799. this.socket.emit("stations.resume", this.station._id, data => {
  800. if (data.status !== "success")
  801. new Toast({
  802. content: `Error: ${data.message}`,
  803. timeout: 8000
  804. });
  805. else
  806. new Toast({
  807. content: "Successfully resumed the station.",
  808. timeout: 4000
  809. });
  810. });
  811. },
  812. pauseStation() {
  813. this.socket.emit("stations.pause", this.station._id, data => {
  814. if (data.status !== "success")
  815. new Toast({
  816. content: `Error: ${data.message}`,
  817. timeout: 8000
  818. });
  819. else
  820. new Toast({
  821. content: "Successfully paused the station.",
  822. timeout: 4000
  823. });
  824. });
  825. },
  826. toggleMute() {
  827. if (this.playerReady) {
  828. const previousVolume = parseFloat(
  829. localStorage.getItem("volume")
  830. );
  831. const volume =
  832. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  833. this.muted = !this.muted;
  834. localStorage.setItem("muted", this.muted);
  835. document.getElementById("volumeSlider").value = volume * 100;
  836. this.player.setVolume(volume);
  837. if (!this.muted) localStorage.setItem("volume", volume);
  838. }
  839. },
  840. increaseVolume() {
  841. if (this.playerReady) {
  842. const previousVolume = parseInt(localStorage.getItem("volume"));
  843. let volume = previousVolume + 5;
  844. if (previousVolume === 0) {
  845. this.muted = false;
  846. localStorage.setItem("muted", false);
  847. }
  848. if (volume > 100) volume = 100;
  849. document.getElementById("volumeSlider").value = volume * 100;
  850. this.player.setVolume(volume);
  851. localStorage.setItem("volume", volume);
  852. }
  853. },
  854. toggleLike() {
  855. if (this.liked)
  856. this.socket.emit(
  857. "songs.unlike",
  858. this.currentSong.songId,
  859. data => {
  860. if (data.status !== "success")
  861. new Toast({
  862. content: `Error: ${data.message}`,
  863. timeout: 8000
  864. });
  865. }
  866. );
  867. else
  868. this.socket.emit(
  869. "songs.like",
  870. this.currentSong.songId,
  871. data => {
  872. if (data.status !== "success")
  873. new Toast({
  874. content: `Error: ${data.message}`,
  875. timeout: 8000
  876. });
  877. }
  878. );
  879. },
  880. toggleDislike() {
  881. if (this.disliked)
  882. return this.socket.emit(
  883. "songs.undislike",
  884. this.currentSong.songId,
  885. data => {
  886. if (data.status !== "success")
  887. new Toast({
  888. content: `Error: ${data.message}`,
  889. timeout: 8000
  890. });
  891. }
  892. );
  893. return this.socket.emit(
  894. "songs.dislike",
  895. this.currentSong.songId,
  896. data => {
  897. if (data.status !== "success")
  898. new Toast({
  899. content: `Error: ${data.message}`,
  900. timeout: 8000
  901. });
  902. }
  903. );
  904. },
  905. addFirstPrivatePlaylistSongToQueue() {
  906. let isInQueue = false;
  907. if (this.station.type === "community") {
  908. this.songsList.forEach(queueSong => {
  909. if (queueSong.requestedBy === this.userId) isInQueue = true;
  910. });
  911. if (!isInQueue && this.privatePlaylistQueueSelected) {
  912. this.socket.emit(
  913. "playlists.getFirstSong",
  914. this.privatePlaylistQueueSelected,
  915. data => {
  916. if (data.status === "success") {
  917. if (data.song.duration < 15 * 60) {
  918. this.automaticallyRequestedSongId =
  919. data.song.songId;
  920. this.socket.emit(
  921. "stations.addToQueue",
  922. this.station._id,
  923. data.song.songId,
  924. data2 => {
  925. if (data2.status === "success") {
  926. this.socket.emit(
  927. "playlists.moveSongToBottom",
  928. this
  929. .privatePlaylistQueueSelected,
  930. data.song.songId,
  931. data3 => {
  932. if (
  933. data3.status ===
  934. "success"
  935. ) {} // eslint-disable-line
  936. }
  937. );
  938. }
  939. }
  940. );
  941. } else {
  942. new Toast({
  943. content: `Top song in playlist was too long to be added.`,
  944. timeout: 3000
  945. });
  946. this.socket.emit(
  947. "playlists.moveSongToBottom",
  948. this.privatePlaylistQueueSelected,
  949. data.song.songId,
  950. data3 => {
  951. if (data3.status === "success") {
  952. setTimeout(() => {
  953. this.addFirstPrivatePlaylistSongToQueue();
  954. }, 3000);
  955. }
  956. }
  957. );
  958. }
  959. }
  960. }
  961. );
  962. }
  963. }
  964. },
  965. join() {
  966. this.socket.emit("stations.join", this.stationName, res => {
  967. if (res.status === "success") {
  968. this.loading = false;
  969. const {
  970. _id,
  971. displayName,
  972. description,
  973. privacy,
  974. locked,
  975. partyMode,
  976. owner,
  977. privatePlaylist,
  978. type,
  979. theme
  980. } = res.data;
  981. this.joinStation({
  982. _id,
  983. name: this.stationName,
  984. displayName,
  985. description,
  986. privacy,
  987. locked,
  988. partyMode,
  989. owner,
  990. privatePlaylist,
  991. type,
  992. theme
  993. });
  994. const currentSong = res.data.currentSong
  995. ? res.data.currentSong
  996. : {};
  997. if (currentSong.artists)
  998. currentSong.artists = currentSong.artists.join(", ");
  999. this.updateCurrentSong(currentSong);
  1000. this.startedAt = res.data.startedAt;
  1001. this.updatePaused(res.data.paused);
  1002. this.timePaused = res.data.timePaused;
  1003. this.updateUserCount(res.data.userCount);
  1004. this.updateUsers(res.data.users);
  1005. this.pausedAt = res.data.pausedAt;
  1006. if (res.data.currentSong) {
  1007. this.updateNoSong(false);
  1008. this.youtubeReady();
  1009. this.playVideo();
  1010. this.socket.emit(
  1011. "songs.getOwnSongRatings",
  1012. res.data.currentSong.songId,
  1013. data => {
  1014. if (this.currentSong.songId === data.songId) {
  1015. this.liked = data.liked;
  1016. this.disliked = data.disliked;
  1017. }
  1018. }
  1019. );
  1020. } else {
  1021. if (this.playerReady) this.player.pauseVideo();
  1022. this.updateNoSong(true);
  1023. }
  1024. if (type === "community" && partyMode === true) {
  1025. this.socket.emit("stations.getQueue", _id, res => {
  1026. if (res.status === "success") {
  1027. this.updateSongsList(res.queue);
  1028. }
  1029. });
  1030. }
  1031. // UNIX client time before ping
  1032. const beforePing = Date.now();
  1033. this.socket.emit("apis.ping", pong => {
  1034. // UNIX client time after ping
  1035. const afterPing = Date.now();
  1036. // Average time in MS it took between the server responding and the client receiving
  1037. const connectionLatency = (afterPing - beforePing) / 2;
  1038. console.log(connectionLatency, beforePing - afterPing);
  1039. // UNIX server time
  1040. const serverDate = pong.date;
  1041. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1042. const difference =
  1043. serverDate + connectionLatency - afterPing;
  1044. console.log("Difference: ", difference);
  1045. if (difference > 3000 || difference < -3000) {
  1046. console.log(
  1047. "System time difference is bigger than 3 seconds."
  1048. );
  1049. }
  1050. this.systemDifference = difference;
  1051. });
  1052. } else {
  1053. this.loading = false;
  1054. this.exists = false;
  1055. }
  1056. });
  1057. },
  1058. ...mapActions("modals", ["openModal"]),
  1059. ...mapActions("station", [
  1060. "joinStation",
  1061. "updateUserCount",
  1062. "updateUsers",
  1063. "updateCurrentSong",
  1064. "updatePreviousSong",
  1065. "updateSongsList",
  1066. "updatePaused",
  1067. "updateNoSong"
  1068. ])
  1069. },
  1070. mounted() {
  1071. Date.currently = () => {
  1072. return new Date().getTime() + this.systemDifference;
  1073. };
  1074. this.stationName = this.$route.params.id;
  1075. window.stationInterval = 0;
  1076. io.getSocket(socket => {
  1077. this.socket = socket;
  1078. io.removeAllListeners();
  1079. if (this.socket.connected) this.join();
  1080. io.onConnect(this.join);
  1081. this.socket.emit("stations.existsByName", this.stationName, res => {
  1082. if (res.status === "failure" || !res.exists) {
  1083. this.loading = false;
  1084. this.exists = false;
  1085. }
  1086. });
  1087. this.socket.on("event:songs.next", data => {
  1088. const previousSong = this.currentSong.songId
  1089. ? this.currentSong
  1090. : null;
  1091. this.updatePreviousSong(previousSong);
  1092. this.updateCurrentSong(
  1093. data.currentSong ? data.currentSong : {}
  1094. );
  1095. this.startedAt = data.startedAt;
  1096. this.updatePaused(data.paused);
  1097. this.timePaused = data.timePaused;
  1098. if (data.currentSong) {
  1099. this.updateNoSong(false);
  1100. if (this.currentSong.artists)
  1101. this.currentSong.artists = this.currentSong.artists.join(
  1102. ", "
  1103. );
  1104. if (!this.playerReady) this.youtubeReady();
  1105. else this.playVideo();
  1106. this.socket.emit(
  1107. "songs.getOwnSongRatings",
  1108. data.currentSong.songId,
  1109. song => {
  1110. if (this.currentSong.songId === song.songId) {
  1111. this.liked = song.liked;
  1112. this.disliked = song.disliked;
  1113. }
  1114. }
  1115. );
  1116. } else {
  1117. if (this.playerReady) this.player.pauseVideo();
  1118. this.updateNoSong(true);
  1119. }
  1120. let isInQueue = false;
  1121. this.songsList.forEach(queueSong => {
  1122. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1123. });
  1124. if (
  1125. !isInQueue &&
  1126. this.privatePlaylistQueueSelected &&
  1127. (this.automaticallyRequestedSongId !==
  1128. this.currentSong.songId ||
  1129. !this.currentSong.songId)
  1130. ) {
  1131. this.addFirstPrivatePlaylistSongToQueue();
  1132. }
  1133. });
  1134. this.socket.on("event:stations.pause", data => {
  1135. this.pausedAt = data.pausedAt;
  1136. this.pauseLocalStation();
  1137. });
  1138. this.socket.on("event:stations.resume", data => {
  1139. this.timePaused = data.timePaused;
  1140. this.resumeLocalStation();
  1141. });
  1142. this.socket.on("event:stations.remove", () => {
  1143. window.location.href = "/";
  1144. return true;
  1145. });
  1146. this.socket.on("event:song.like", data => {
  1147. if (!this.noSong) {
  1148. if (data.songId === this.currentSong.songId) {
  1149. this.currentSong.dislikes = data.dislikes;
  1150. this.currentSong.likes = data.likes;
  1151. }
  1152. }
  1153. });
  1154. this.socket.on("event:song.dislike", data => {
  1155. if (!this.noSong) {
  1156. if (data.songId === this.currentSong.songId) {
  1157. this.currentSong.dislikes = data.dislikes;
  1158. this.currentSong.likes = data.likes;
  1159. }
  1160. }
  1161. });
  1162. this.socket.on("event:song.unlike", data => {
  1163. if (!this.noSong) {
  1164. if (data.songId === this.currentSong.songId) {
  1165. this.currentSong.dislikes = data.dislikes;
  1166. this.currentSong.likes = data.likes;
  1167. }
  1168. }
  1169. });
  1170. this.socket.on("event:song.undislike", data => {
  1171. if (!this.noSong) {
  1172. if (data.songId === this.currentSong.songId) {
  1173. this.currentSong.dislikes = data.dislikes;
  1174. this.currentSong.likes = data.likes;
  1175. }
  1176. }
  1177. });
  1178. this.socket.on("event:song.newRatings", data => {
  1179. if (!this.noSong) {
  1180. if (data.songId === this.currentSong.songId) {
  1181. this.liked = data.liked;
  1182. this.disliked = data.disliked;
  1183. }
  1184. }
  1185. });
  1186. this.socket.on("event:queue.update", queue => {
  1187. if (this.station.type === "community")
  1188. this.updateSongsList(queue);
  1189. });
  1190. this.socket.on("event:song.voteSkipSong", () => {
  1191. if (this.currentSong) this.currentSong.skipVotes += 1;
  1192. });
  1193. this.socket.on("event:privatePlaylist.selected", playlistId => {
  1194. if (this.station.type === "community") {
  1195. this.station.privatePlaylist = playlistId;
  1196. }
  1197. });
  1198. this.socket.on("event:partyMode.updated", partyMode => {
  1199. if (this.station.type === "community") {
  1200. this.station.partyMode = partyMode;
  1201. }
  1202. });
  1203. this.socket.on("event:newOfficialPlaylist", playlist => {
  1204. if (this.station.type === "official") {
  1205. this.updateSongsList(playlist);
  1206. }
  1207. });
  1208. this.socket.on("event:users.updated", users => {
  1209. this.updateUsers(users);
  1210. });
  1211. this.socket.on("event:userCount.updated", userCount => {
  1212. this.updateUserCount(userCount);
  1213. });
  1214. this.socket.on("event:queueLockToggled", locked => {
  1215. this.station.locked = locked;
  1216. });
  1217. });
  1218. if (JSON.parse(localStorage.getItem("muted"))) {
  1219. this.muted = true;
  1220. this.player.setVolume(0);
  1221. document.getElementById("volumeSlider").value = 0 * 100;
  1222. } else {
  1223. let volume = parseFloat(localStorage.getItem("volume"));
  1224. volume =
  1225. typeof volume === "number" && !Number.isNaN(volume)
  1226. ? volume
  1227. : 20;
  1228. localStorage.setItem("volume", volume);
  1229. document.getElementById("volumeSlider").value = volume * 100;
  1230. }
  1231. },
  1232. components: {
  1233. StationHeader,
  1234. SongQueue: () => import("../Modals/AddSongToQueue.vue"),
  1235. AddToPlaylist: () => import("../Modals/AddSongToPlaylist.vue"),
  1236. EditPlaylist: () => import("../Modals/Playlists/Edit.vue"),
  1237. CreatePlaylist: () => import("../Modals/Playlists/Create.vue"),
  1238. EditStation: () => import("../Modals/EditStation.vue"),
  1239. Report: () => import("../Modals/Report.vue"),
  1240. SongsListSidebar: () => import("../Sidebars/SongsList.vue"),
  1241. PlaylistSidebar: () => import("../Sidebars/Playlist.vue"),
  1242. UsersSidebar: () => import("../Sidebars/UsersList.vue"),
  1243. UserIdToUsername,
  1244. Z404
  1245. }
  1246. };
  1247. </script>
  1248. <style lang="scss">
  1249. @import "scss/variables/colors.scss";
  1250. .player-can-not-autoplay {
  1251. position: absolute;
  1252. width: 100%;
  1253. height: 100%;
  1254. background: rgba(3, 169, 244, 0.95);
  1255. display: flex;
  1256. align-items: center;
  1257. justify-content: center;
  1258. p {
  1259. color: $white;
  1260. font-size: 26px;
  1261. text-align: center;
  1262. }
  1263. }
  1264. .slide-enter-active,
  1265. .slide-leave-active {
  1266. transition: all 0.3s ease;
  1267. }
  1268. .slide-enter {
  1269. opacity: 0;
  1270. transform: translateY(-300px);
  1271. }
  1272. .slide-leave-to {
  1273. transform: translateY(300px);
  1274. opacity: 0;
  1275. }
  1276. .no-song {
  1277. color: $primary-color;
  1278. text-align: center;
  1279. }
  1280. #volumeSlider {
  1281. padding: 0 15px;
  1282. background: transparent;
  1283. }
  1284. .volume-slider-wrapper {
  1285. margin-top: 0;
  1286. position: relative;
  1287. display: flex;
  1288. align-items: center;
  1289. .material-icons {
  1290. user-select: none;
  1291. }
  1292. }
  1293. .material-icons {
  1294. cursor: pointer;
  1295. }
  1296. .stationDisplayName {
  1297. color: $white !important;
  1298. }
  1299. .add-to-playlist {
  1300. display: flex;
  1301. align-items: center;
  1302. justify-content: center;
  1303. }
  1304. .slideout {
  1305. top: 50px;
  1306. height: 100%;
  1307. position: fixed;
  1308. right: 0;
  1309. width: 350px;
  1310. background-color: $white;
  1311. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1312. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1313. .slideout-header {
  1314. text-align: center;
  1315. background-color: $primary-color !important;
  1316. margin: 0;
  1317. padding-top: 5px;
  1318. padding-bottom: 7px;
  1319. color: $white;
  1320. }
  1321. .slideout-content {
  1322. height: 100%;
  1323. }
  1324. }
  1325. .modal-large {
  1326. width: 75%;
  1327. }
  1328. .station {
  1329. flex: 1 0 auto;
  1330. padding-top: 0.5vw;
  1331. transition: all 0.1s;
  1332. margin: 0 auto;
  1333. max-width: 100%;
  1334. width: 90%;
  1335. min-height: calc(100vh - 66px);
  1336. @media only screen and (min-width: 993px) {
  1337. width: 70%;
  1338. }
  1339. @media only screen and (min-width: 601px) {
  1340. width: 85%;
  1341. }
  1342. @media (min-width: 999px) {
  1343. .mobile-only {
  1344. display: none;
  1345. }
  1346. .desktop-only {
  1347. display: block;
  1348. }
  1349. }
  1350. @media (max-width: 998px) {
  1351. .mobile-only {
  1352. display: block;
  1353. }
  1354. .desktop-only {
  1355. display: none;
  1356. visibility: hidden;
  1357. }
  1358. }
  1359. .mobile-only {
  1360. text-align: center;
  1361. }
  1362. .playlistCard {
  1363. margin: 10px;
  1364. position: relative;
  1365. padding-bottom: calc(31.25% + 7px);
  1366. height: 0;
  1367. overflow-y: scroll;
  1368. .title {
  1369. background-color: rgb(3, 169, 244);
  1370. text-align: center;
  1371. padding: 10px;
  1372. color: $white;
  1373. font-weight: 600;
  1374. }
  1375. .media {
  1376. padding: 0 25px;
  1377. }
  1378. .media-content .content {
  1379. min-height: 64px;
  1380. max-height: 64px;
  1381. display: flex;
  1382. align-items: center;
  1383. }
  1384. .content p strong {
  1385. word-break: break-word;
  1386. }
  1387. .content p small {
  1388. word-break: break-word;
  1389. }
  1390. .add-to-queue {
  1391. width: 100%;
  1392. margin-top: 25px;
  1393. height: 40px;
  1394. border-radius: 0;
  1395. background: rgb(3, 169, 244);
  1396. color: $white !important;
  1397. border: 0;
  1398. &:active,
  1399. &:focus {
  1400. border: 0;
  1401. }
  1402. }
  1403. .add-to-queue:focus {
  1404. background: $primary-color;
  1405. }
  1406. .media-right {
  1407. line-height: 64px;
  1408. }
  1409. .songTitle {
  1410. word-wrap: break-word;
  1411. overflow: hidden;
  1412. text-overflow: ellipsis;
  1413. display: -webkit-box;
  1414. -webkit-box-orient: vertical;
  1415. -webkit-line-clamp: 2;
  1416. line-height: 20px;
  1417. max-height: 40px;
  1418. width: 100%;
  1419. }
  1420. }
  1421. input[type="range"] {
  1422. -webkit-appearance: none;
  1423. width: 100%;
  1424. margin: 7.3px 0;
  1425. }
  1426. input[type="range"]:focus {
  1427. outline: none;
  1428. }
  1429. input[type="range"]::-webkit-slider-runnable-track {
  1430. width: 100%;
  1431. height: 5.2px;
  1432. cursor: pointer;
  1433. box-shadow: 0;
  1434. background: $light-grey-2;
  1435. border-radius: 0;
  1436. border: 0;
  1437. }
  1438. input[type="range"]::-webkit-slider-thumb {
  1439. box-shadow: 0;
  1440. border: 0;
  1441. height: 19px;
  1442. width: 19px;
  1443. border-radius: 15px;
  1444. background: $primary-color;
  1445. cursor: pointer;
  1446. -webkit-appearance: none;
  1447. margin-top: -6.5px;
  1448. }
  1449. input[type="range"]::-moz-range-track {
  1450. width: 100%;
  1451. height: 5.2px;
  1452. cursor: pointer;
  1453. box-shadow: 0;
  1454. background: $light-grey-2;
  1455. border-radius: 0;
  1456. border: 0;
  1457. }
  1458. input[type="range"]::-moz-range-thumb {
  1459. box-shadow: 0;
  1460. border: 0;
  1461. height: 19px;
  1462. width: 19px;
  1463. border-radius: 15px;
  1464. background: $primary-color;
  1465. cursor: pointer;
  1466. -webkit-appearance: none;
  1467. margin-top: -6.5px;
  1468. }
  1469. input[type="range"]::-ms-track {
  1470. width: 100%;
  1471. height: 5.2px;
  1472. cursor: pointer;
  1473. box-shadow: 0;
  1474. background: $light-grey-2;
  1475. border-radius: 1.3px;
  1476. }
  1477. input[type="range"]::-ms-fill-lower {
  1478. background: $light-grey-2;
  1479. border: 0;
  1480. border-radius: 0;
  1481. box-shadow: 0;
  1482. }
  1483. input[type="range"]::-ms-fill-upper {
  1484. background: $light-grey-2;
  1485. border: 0;
  1486. border-radius: 0;
  1487. box-shadow: 0;
  1488. }
  1489. input[type="range"]::-ms-thumb {
  1490. box-shadow: 0;
  1491. border: 0;
  1492. height: 15px;
  1493. width: 15px;
  1494. border-radius: 15px;
  1495. background: $primary-color;
  1496. cursor: pointer;
  1497. -webkit-appearance: none;
  1498. margin-top: 1.5px;
  1499. }
  1500. .video-container {
  1501. position: relative;
  1502. padding-bottom: 56.25%;
  1503. height: 0;
  1504. overflow: hidden;
  1505. iframe {
  1506. position: absolute;
  1507. top: 0;
  1508. left: 0;
  1509. width: 100%;
  1510. height: 100%;
  1511. }
  1512. }
  1513. .video-col {
  1514. padding-right: 0.75rem;
  1515. padding-left: 0.75rem;
  1516. }
  1517. }
  1518. .room-title {
  1519. left: 50%;
  1520. -webkit-transform: translateX(-50%);
  1521. transform: translateX(-50%);
  1522. font-size: 2.1em;
  1523. }
  1524. #ratings {
  1525. span {
  1526. font-size: 1.68rem;
  1527. }
  1528. i {
  1529. color: #9e9e9e !important;
  1530. cursor: pointer;
  1531. transition: 0.1s color;
  1532. }
  1533. }
  1534. #time-display {
  1535. margin-top: 30px;
  1536. float: right;
  1537. }
  1538. #thumbs_up:hover,
  1539. #thumbs_up.liked {
  1540. color: $green !important;
  1541. }
  1542. #thumbs_down:hover,
  1543. #thumbs_down.disliked {
  1544. color: $red !important;
  1545. }
  1546. #song-thumbnail {
  1547. max-width: 100%;
  1548. width: 85%;
  1549. }
  1550. .seeker-bar-container {
  1551. position: relative;
  1552. height: 7px;
  1553. display: block;
  1554. width: 100%;
  1555. overflow: hidden;
  1556. }
  1557. .seeker-bar {
  1558. top: 0;
  1559. left: 0;
  1560. bottom: 0;
  1561. position: absolute;
  1562. background-color: $musareBlue;
  1563. }
  1564. ul {
  1565. list-style: none;
  1566. margin: 0;
  1567. display: block;
  1568. }
  1569. h1,
  1570. h2,
  1571. h3,
  1572. h4,
  1573. h5,
  1574. h6 {
  1575. font-weight: 400;
  1576. line-height: 1.1;
  1577. }
  1578. h1 a,
  1579. h2 a,
  1580. h3 a,
  1581. h4 a,
  1582. h5 a,
  1583. h6 a {
  1584. font-weight: inherit;
  1585. }
  1586. h1 {
  1587. font-size: 4.2rem;
  1588. line-height: 110%;
  1589. margin: 2.1rem 0 1.68rem 0;
  1590. }
  1591. h2 {
  1592. font-size: 3.56rem;
  1593. line-height: 110%;
  1594. margin: 1.78rem 0 1.424rem 0;
  1595. }
  1596. h3 {
  1597. font-size: 2.92rem;
  1598. line-height: 110%;
  1599. margin: 1.46rem 0 1.168rem 0;
  1600. }
  1601. h4 {
  1602. font-size: 2.28rem;
  1603. line-height: 110%;
  1604. margin: 1.14rem 0 0.912rem 0;
  1605. }
  1606. h5 {
  1607. font-size: 1.64rem;
  1608. line-height: 110%;
  1609. margin: 0.82rem 0 0.656rem 0;
  1610. }
  1611. h6 {
  1612. font-size: 1rem;
  1613. line-height: 110%;
  1614. margin: 0.5rem 0 0.4rem 0;
  1615. }
  1616. .thin {
  1617. font-weight: 200;
  1618. }
  1619. .left {
  1620. float: left !important;
  1621. }
  1622. .right {
  1623. float: right !important;
  1624. }
  1625. .light-blue {
  1626. background-color: $primary-color !important;
  1627. }
  1628. .white {
  1629. background-color: $white !important;
  1630. }
  1631. .btn-search {
  1632. font-size: 14px;
  1633. }
  1634. .menu {
  1635. padding: 0 10px;
  1636. }
  1637. .menu-list li a:hover {
  1638. color: #000 !important;
  1639. }
  1640. .menu-list li {
  1641. display: flex;
  1642. justify-content: space-between;
  1643. }
  1644. .menu-list a {
  1645. /*padding: 0 10px !important;*/
  1646. }
  1647. .menu-list a:hover {
  1648. background-color: transparent;
  1649. }
  1650. .icons-group {
  1651. display: flex;
  1652. }
  1653. #like,
  1654. #dislike {
  1655. position: relative;
  1656. }
  1657. .behind {
  1658. z-index: -1;
  1659. }
  1660. .behind:focus {
  1661. z-index: 0;
  1662. }
  1663. .progress {
  1664. width: 50px;
  1665. animation: rotate 0.8s infinite linear;
  1666. border: 8px solid $primary-color;
  1667. border-right-color: transparent;
  1668. height: 50px;
  1669. position: absolute;
  1670. top: 50%;
  1671. left: 50%;
  1672. }
  1673. @keyframes rotate {
  1674. 0% {
  1675. transform: rotate(0deg);
  1676. }
  1677. 100% {
  1678. transform: rotate(360deg);
  1679. }
  1680. }
  1681. .experimental {
  1682. display: none !important;
  1683. }
  1684. .purpleTheme {
  1685. .slideout .slideout-header,
  1686. .sidebar .title,
  1687. .seeker-bar,
  1688. .add-to-queue,
  1689. .add-to-playlist,
  1690. .create-playlist {
  1691. background-color: $light-purple !important;
  1692. }
  1693. .player-can-not-autoplay {
  1694. background: rgba($light-purple, 0.95);
  1695. }
  1696. .no-song {
  1697. color: $light-purple;
  1698. }
  1699. .station input[type="range"] {
  1700. &::-webkit-slider-thumb {
  1701. background: $light-purple !important;
  1702. }
  1703. &::-moz-range-thumb {
  1704. background: $light-purple !important;
  1705. }
  1706. &::-ms-thumb {
  1707. background: $light-purple !important;
  1708. }
  1709. }
  1710. }
  1711. .tealTheme {
  1712. .slideout .slideout-header,
  1713. .sidebar .title,
  1714. .seeker-bar,
  1715. .add-to-queue,
  1716. .add-to-playlist,
  1717. .create-playlist {
  1718. background-color: $teal !important;
  1719. }
  1720. .player-can-not-autoplay {
  1721. background: rgba($teal, 0.95);
  1722. }
  1723. .no-song {
  1724. color: $teal;
  1725. }
  1726. .station input[type="range"] {
  1727. &::-webkit-slider-thumb {
  1728. background: $teal !important;
  1729. }
  1730. &::-moz-range-thumb {
  1731. background: $teal !important;
  1732. }
  1733. &::-ms-thumb {
  1734. background: $teal !important;
  1735. }
  1736. }
  1737. }
  1738. .blueTheme {
  1739. .slideout .slideout-header,
  1740. .sidebar .title,
  1741. .seeker-bar,
  1742. .add-to-queue,
  1743. .add-to-playlist,
  1744. .create-playlist {
  1745. background-color: $musareBlue !important;
  1746. }
  1747. .player-can-not-autoplay {
  1748. background: rgba($musareBlue, 0.95);
  1749. }
  1750. .no-song {
  1751. color: $musareBlue;
  1752. }
  1753. .station input[type="range"] {
  1754. &::-webkit-slider-thumb {
  1755. background: $musareBlue !important;
  1756. }
  1757. &::-moz-range-thumb {
  1758. background: $musareBlue !important;
  1759. }
  1760. &::-ms-thumb {
  1761. background: $musareBlue !important;
  1762. }
  1763. }
  1764. }
  1765. .darkTheme {
  1766. background: $dark-grey;
  1767. color: $light-grey;
  1768. .seeker-bar,
  1769. .add-to-queue,
  1770. .add-to-playlist,
  1771. .create-playlist {
  1772. background-color: $dark-grey-2 !important;
  1773. }
  1774. .sidebar,
  1775. .slideout {
  1776. background-color: $dark-grey !important;
  1777. .slideout-header,
  1778. .title {
  1779. background-color: $dark-grey-2 !important;
  1780. }
  1781. }
  1782. .player-can-not-autoplay {
  1783. background: rgba($dark-grey-3, 0.95);
  1784. }
  1785. .no-song,
  1786. .content,
  1787. strong {
  1788. color: $light-grey;
  1789. }
  1790. .station input[type="range"] {
  1791. &::-webkit-slider-thumb {
  1792. background: $dark-grey-3 !important;
  1793. }
  1794. &::-moz-range-thumb {
  1795. background: $dark-grey-3 !important;
  1796. }
  1797. &::-ms-thumb {
  1798. background: $dark-grey-3 !important;
  1799. }
  1800. }
  1801. }
  1802. </style>