Station.vue 41 KB

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