Station.vue 41 KB

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