index.vue 46 KB

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