Station.vue 45 KB

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