index.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991
  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 "../../components/common/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("./AddSongToQueue.vue"),
  1334. AddToPlaylist: () => import("./AddSongToPlaylist.vue"),
  1335. EditPlaylist: () => import("../../components/modals/EditPlaylist.vue"),
  1336. CreatePlaylist: () =>
  1337. import("../../components/modals/CreatePlaylist.vue"),
  1338. EditStation: () => import("../../components/modals/EditStation.vue"),
  1339. Report: () => import("./Report.vue"),
  1340. SongsListSidebar: () => import("./SongsList.vue"),
  1341. UsersSidebar: () => import("./UsersList.vue"),
  1342. UserIdToUsername,
  1343. Z404
  1344. }
  1345. };
  1346. </script>
  1347. <style lang="scss">
  1348. @import "../../styles/global.scss";
  1349. .station-parent {
  1350. display: flex;
  1351. flex: 1;
  1352. overflow-x: hidden;
  1353. }
  1354. .night-mode {
  1355. .nav,
  1356. .control-sidebar {
  1357. background-color: #222;
  1358. }
  1359. }
  1360. .player-can-not-autoplay {
  1361. position: absolute;
  1362. width: 100%;
  1363. height: 100%;
  1364. background: rgba(3, 169, 244, 0.95);
  1365. display: flex;
  1366. align-items: center;
  1367. justify-content: center;
  1368. p {
  1369. color: $white;
  1370. font-size: 26px;
  1371. text-align: center;
  1372. }
  1373. }
  1374. // Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
  1375. .slide-outer-enter {
  1376. margin-right: -300px;
  1377. }
  1378. // 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.
  1379. .slide-outer-enter-active {
  1380. transition: all 0.3s linear;
  1381. }
  1382. // 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.
  1383. .slide-outer-enter-to {
  1384. margin-right: 0;
  1385. }
  1386. // Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
  1387. .slide-outer-leave {
  1388. margin-right: 0;
  1389. }
  1390. // 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.
  1391. .slide-outer-leave-active {
  1392. transition: all 0.3s linear;
  1393. }
  1394. // 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.
  1395. .slide-outer-leave-to {
  1396. margin-right: -300px;
  1397. }
  1398. // Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
  1399. .slide-inner-enter {
  1400. transform: translateX(300px);
  1401. }
  1402. // 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.
  1403. .slide-inner-enter-active {
  1404. transition: all 0.3s linear;
  1405. z-index: 5;
  1406. }
  1407. // 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.
  1408. .slide-inner-enter-to {
  1409. transform: translateX(0px);
  1410. }
  1411. // Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
  1412. .slide-inner-leave {
  1413. transform: translateX(0px);
  1414. }
  1415. // 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.
  1416. .slide-inner-leave-active {
  1417. transition: all 0.3s linear;
  1418. z-index: 0;
  1419. }
  1420. // 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.
  1421. .slide-inner-leave-to {
  1422. transform: translateX(300px);
  1423. }
  1424. .sidebar-container {
  1425. width: 300px;
  1426. max-width: 300px;
  1427. // background-color: blue;
  1428. position: relative;
  1429. }
  1430. .sidebar {
  1431. position: absolute;
  1432. // z-index: 1;
  1433. top: 0;
  1434. right: 0;
  1435. width: 300px;
  1436. height: 100%;
  1437. background-color: $white;
  1438. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1439. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1440. }
  1441. .no-song {
  1442. color: $primary-color;
  1443. text-align: center;
  1444. }
  1445. .volumeSlider {
  1446. padding: 0 15px;
  1447. background: transparent;
  1448. }
  1449. .volume-slider-wrapper {
  1450. margin-top: 0;
  1451. position: relative;
  1452. display: flex;
  1453. align-items: center;
  1454. .material-icons {
  1455. user-select: none;
  1456. }
  1457. }
  1458. .material-icons {
  1459. cursor: pointer;
  1460. }
  1461. .stationDisplayName {
  1462. color: $white !important;
  1463. }
  1464. .add-to-playlist {
  1465. display: flex;
  1466. align-items: center;
  1467. justify-content: center;
  1468. }
  1469. // .slideout {
  1470. // top: 50px;
  1471. // height: 100%;
  1472. // position: fixed;
  1473. // right: 0;
  1474. // width: 350px;
  1475. // background-color: $white;
  1476. // box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1477. // 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1478. // .slideout-header {
  1479. // text-align: center;
  1480. // background-color: rgb(3, 169, 244) !important;
  1481. // margin: 0;
  1482. // padding-top: 5px;
  1483. // padding-bottom: 7px;
  1484. // color: $white;
  1485. // }
  1486. // .slideout-content {
  1487. // height: 100%;
  1488. // }
  1489. // }
  1490. .modal-large {
  1491. width: 75%;
  1492. }
  1493. .station {
  1494. padding-top: 0.5vw;
  1495. transition: all 0.1s;
  1496. margin: 0 auto;
  1497. flex: 0.9;
  1498. @media only screen and (min-width: 993px) {
  1499. flex: 0.7;
  1500. }
  1501. @media only screen and (min-width: 601px) {
  1502. flex: 0.85;
  1503. }
  1504. @media (min-width: 999px) {
  1505. .mobile-only {
  1506. display: none;
  1507. }
  1508. .desktop-only {
  1509. display: block;
  1510. }
  1511. }
  1512. @media (max-width: 998px) {
  1513. .mobile-only {
  1514. display: block;
  1515. }
  1516. .desktop-only {
  1517. display: none;
  1518. visibility: hidden;
  1519. }
  1520. }
  1521. .mobile-only {
  1522. text-align: center;
  1523. }
  1524. .playlistCard {
  1525. margin: 10px;
  1526. position: relative;
  1527. padding-bottom: calc(31.25% + 7px);
  1528. height: 0;
  1529. overflow-y: scroll;
  1530. .title {
  1531. background-color: rgb(3, 169, 244);
  1532. text-align: center;
  1533. padding: 10px;
  1534. color: $white;
  1535. font-weight: 600;
  1536. }
  1537. .media {
  1538. padding: 0 25px;
  1539. }
  1540. .media-content .content {
  1541. min-height: 64px;
  1542. max-height: 64px;
  1543. display: flex;
  1544. align-items: center;
  1545. }
  1546. .content p strong {
  1547. word-break: break-word;
  1548. }
  1549. .content p small {
  1550. word-break: break-word;
  1551. }
  1552. .add-to-queue {
  1553. width: 100%;
  1554. margin-top: 25px;
  1555. height: 40px;
  1556. border-radius: 0;
  1557. background: rgb(3, 169, 244);
  1558. color: $white !important;
  1559. border: 0;
  1560. &:active,
  1561. &:focus {
  1562. border: 0;
  1563. }
  1564. }
  1565. .add-to-queue:focus {
  1566. background: $primary-color;
  1567. }
  1568. .media-right {
  1569. line-height: 64px;
  1570. }
  1571. .songTitle {
  1572. word-wrap: break-word;
  1573. overflow: hidden;
  1574. text-overflow: ellipsis;
  1575. display: -webkit-box;
  1576. -webkit-box-orient: vertical;
  1577. -webkit-line-clamp: 2;
  1578. line-height: 20px;
  1579. max-height: 40px;
  1580. width: 100%;
  1581. }
  1582. }
  1583. input[type="range"] {
  1584. -webkit-appearance: none;
  1585. width: 100%;
  1586. margin: 7.3px 0;
  1587. }
  1588. input[type="range"]:focus {
  1589. outline: none;
  1590. }
  1591. input[type="range"]::-webkit-slider-runnable-track {
  1592. width: 100%;
  1593. height: 5.2px;
  1594. cursor: pointer;
  1595. box-shadow: 0;
  1596. background: $light-grey-2;
  1597. border-radius: 0;
  1598. border: 0;
  1599. }
  1600. input[type="range"]::-webkit-slider-thumb {
  1601. box-shadow: 0;
  1602. border: 0;
  1603. height: 19px;
  1604. width: 19px;
  1605. border-radius: 15px;
  1606. background: $primary-color;
  1607. cursor: pointer;
  1608. -webkit-appearance: none;
  1609. margin-top: -6.5px;
  1610. }
  1611. input[type="range"]::-moz-range-track {
  1612. width: 100%;
  1613. height: 5.2px;
  1614. cursor: pointer;
  1615. box-shadow: 0;
  1616. background: $light-grey-2;
  1617. border-radius: 0;
  1618. border: 0;
  1619. }
  1620. input[type="range"]::-moz-range-thumb {
  1621. box-shadow: 0;
  1622. border: 0;
  1623. height: 19px;
  1624. width: 19px;
  1625. border-radius: 15px;
  1626. background: $primary-color;
  1627. cursor: pointer;
  1628. -webkit-appearance: none;
  1629. margin-top: -6.5px;
  1630. }
  1631. input[type="range"]::-ms-track {
  1632. width: 100%;
  1633. height: 5.2px;
  1634. cursor: pointer;
  1635. box-shadow: 0;
  1636. background: $light-grey-2;
  1637. border-radius: 1.3px;
  1638. }
  1639. input[type="range"]::-ms-fill-lower {
  1640. background: $light-grey-2;
  1641. border: 0;
  1642. border-radius: 0;
  1643. box-shadow: 0;
  1644. }
  1645. input[type="range"]::-ms-fill-upper {
  1646. background: $light-grey-2;
  1647. border: 0;
  1648. border-radius: 0;
  1649. box-shadow: 0;
  1650. }
  1651. input[type="range"]::-ms-thumb {
  1652. box-shadow: 0;
  1653. border: 0;
  1654. height: 15px;
  1655. width: 15px;
  1656. border-radius: 15px;
  1657. background: $primary-color;
  1658. cursor: pointer;
  1659. -webkit-appearance: none;
  1660. margin-top: 1.5px;
  1661. }
  1662. .video-container {
  1663. position: relative;
  1664. padding-bottom: 56.25%;
  1665. height: 0;
  1666. overflow: hidden;
  1667. iframe {
  1668. position: absolute;
  1669. top: 0;
  1670. left: 0;
  1671. width: 100%;
  1672. height: 100%;
  1673. }
  1674. }
  1675. .video-col {
  1676. padding-right: 0.75rem;
  1677. padding-left: 0.75rem;
  1678. }
  1679. }
  1680. .room-title {
  1681. left: 50%;
  1682. -webkit-transform: translateX(-50%);
  1683. transform: translateX(-50%);
  1684. font-size: 2.1em;
  1685. }
  1686. #ratings {
  1687. display: flex;
  1688. justify-content: flex-end;
  1689. span {
  1690. font-size: 1.68rem;
  1691. }
  1692. i {
  1693. color: #9e9e9e !important;
  1694. cursor: pointer;
  1695. transition: 0.1s color;
  1696. }
  1697. }
  1698. #time-display {
  1699. margin-top: 30px;
  1700. float: right;
  1701. }
  1702. #thumbs_up:hover,
  1703. #thumbs_up.liked {
  1704. color: $green !important;
  1705. }
  1706. #thumbs_down:hover,
  1707. #thumbs_down.disliked {
  1708. color: $red !important;
  1709. }
  1710. #song-thumbnail {
  1711. max-width: 100%;
  1712. width: 85%;
  1713. }
  1714. .seeker-bar-container {
  1715. position: relative;
  1716. height: 7px;
  1717. display: block;
  1718. width: 100%;
  1719. overflow: hidden;
  1720. }
  1721. .seeker-bar {
  1722. top: 0;
  1723. left: 0;
  1724. bottom: 0;
  1725. position: absolute;
  1726. }
  1727. ul {
  1728. list-style: none;
  1729. margin: 0;
  1730. display: block;
  1731. }
  1732. h1,
  1733. h2,
  1734. h3,
  1735. h4,
  1736. h5,
  1737. h6 {
  1738. font-weight: 400;
  1739. line-height: 1.1;
  1740. }
  1741. h1 a,
  1742. h2 a,
  1743. h3 a,
  1744. h4 a,
  1745. h5 a,
  1746. h6 a {
  1747. font-weight: inherit;
  1748. }
  1749. h1 {
  1750. font-size: 4.2rem;
  1751. line-height: 110%;
  1752. margin: 2.1rem 0 1.68rem 0;
  1753. }
  1754. h2 {
  1755. font-size: 3.56rem;
  1756. line-height: 110%;
  1757. margin: 1.78rem 0 1.424rem 0;
  1758. }
  1759. h3 {
  1760. font-size: 2.92rem;
  1761. line-height: 110%;
  1762. margin: 1.46rem 0 1.168rem 0;
  1763. }
  1764. h4 {
  1765. font-size: 2.28rem;
  1766. line-height: 110%;
  1767. margin: 1.14rem 0 0.912rem 0;
  1768. }
  1769. h5 {
  1770. font-size: 1.64rem;
  1771. line-height: 110%;
  1772. margin: 0.82rem 0 0.656rem 0;
  1773. }
  1774. h6 {
  1775. font-size: 1rem;
  1776. line-height: 110%;
  1777. margin: 0.5rem 0 0.4rem 0;
  1778. }
  1779. .thin {
  1780. font-weight: 200;
  1781. }
  1782. .light-blue {
  1783. background-color: $primary-color !important;
  1784. }
  1785. .white {
  1786. background-color: $white !important;
  1787. }
  1788. .btn-search {
  1789. font-size: 14px;
  1790. }
  1791. .menu {
  1792. padding: 0 10px;
  1793. }
  1794. .menu-list li a:hover {
  1795. color: #000 !important;
  1796. }
  1797. .menu-list li {
  1798. display: flex;
  1799. justify-content: space-between;
  1800. }
  1801. .menu-list a {
  1802. /*padding: 0 10px !important;*/
  1803. }
  1804. .menu-list a:hover {
  1805. background-color: transparent;
  1806. }
  1807. .icons-group {
  1808. display: flex;
  1809. }
  1810. #like,
  1811. #dislike {
  1812. position: relative;
  1813. }
  1814. .behind {
  1815. z-index: -1;
  1816. }
  1817. .behind:focus {
  1818. z-index: 0;
  1819. }
  1820. .progress {
  1821. width: 50px;
  1822. animation: rotate 0.8s infinite linear;
  1823. border: 8px solid $primary-color;
  1824. border-right-color: transparent;
  1825. height: 50px;
  1826. position: absolute;
  1827. top: 50%;
  1828. left: 50%;
  1829. }
  1830. @keyframes rotate {
  1831. 0% {
  1832. transform: rotate(0deg);
  1833. }
  1834. 100% {
  1835. transform: rotate(360deg);
  1836. }
  1837. }
  1838. .experimental {
  1839. display: none !important;
  1840. }
  1841. </style>