Station.vue 41 KB

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