Station.vue 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985
  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. toggleSidebar({
  52. sector: 'station',
  53. sidebar: 'playlist'
  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="center">
  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-show="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. <playlist-sidebar v-if="sidebars.playlist" />
  424. </transition>
  425. <transition name="slide-inner">
  426. <users-sidebar v-if="sidebars.users" />
  427. </transition>
  428. </div>
  429. </transition>
  430. </div>
  431. <Z404 v-if="!exists"></Z404>
  432. </div>
  433. </template>
  434. <script>
  435. import { mapState, mapActions } from "vuex";
  436. import Toast from "toasters";
  437. import StationHeader from "./StationHeader.vue";
  438. import UserIdToUsername from "../UserIdToUsername.vue";
  439. import Z404 from "../404.vue";
  440. import io from "../../io";
  441. import keyboardShortcuts from "../../keyboardShortcuts";
  442. import utils from "../../js/utils";
  443. export default {
  444. data() {
  445. return {
  446. utils,
  447. title: "Station",
  448. loading: true,
  449. ready: false,
  450. exists: true,
  451. playerReady: false,
  452. player: undefined,
  453. timePaused: 0,
  454. muted: false,
  455. timeElapsed: "0:00",
  456. liked: false,
  457. disliked: false,
  458. timeBeforePause: 0,
  459. skipVotes: 0,
  460. automaticallyRequestedSongId: null,
  461. systemDifference: 0,
  462. attemptsToPlayVideo: 0,
  463. canAutoplay: true,
  464. lastTimeRequestedIfCanAutoplay: 0,
  465. seeking: false,
  466. playbackRate: 1,
  467. volumeSliderValue: 0
  468. };
  469. },
  470. computed: {
  471. ...mapState("modals", {
  472. modals: state => state.modals.station
  473. }),
  474. ...mapState("sidebars", {
  475. sidebars: state => state.sidebars.station
  476. }),
  477. ...mapState("station", {
  478. station: state => state.station,
  479. currentSong: state => state.currentSong,
  480. songsList: state => state.songsList,
  481. paused: state => state.paused,
  482. noSong: state => state.noSong,
  483. privatePlaylistQueueSelected: state =>
  484. state.privatePlaylistQueueSelected
  485. }),
  486. ...mapState({
  487. loggedIn: state => state.user.auth.loggedIn,
  488. userId: state => state.user.auth.userId,
  489. role: state => state.user.auth.role
  490. }),
  491. sidebarActive() {
  492. return Object.values(this.sidebars).indexOf(true) !== -1;
  493. }
  494. },
  495. methods: {
  496. isOwnerOnly() {
  497. return this.loggedIn && this.userId === this.station.owner;
  498. },
  499. isAdminOnly() {
  500. return this.loggedIn && this.role === "admin";
  501. },
  502. isOwnerOrAdmin() {
  503. return this.isOwnerOnly() || this.isAdminOnly();
  504. },
  505. removeFromQueue(songId) {
  506. window.socket.emit(
  507. "stations.removeFromQueue",
  508. this.station._id,
  509. songId,
  510. res => {
  511. if (res.status === "success") {
  512. new Toast({
  513. content:
  514. "Successfully removed song from the queue.",
  515. timeout: 4000
  516. });
  517. } else new Toast({ content: res.message, timeout: 8000 });
  518. }
  519. );
  520. },
  521. youtubeReady() {
  522. if (!this.player) {
  523. this.player = new window.YT.Player("player", {
  524. height: 270,
  525. width: 480,
  526. videoId: this.currentSong.songId,
  527. startSeconds:
  528. this.getTimeElapsed() / 1000 +
  529. this.currentSong.skipDuration,
  530. playerVars: {
  531. controls: 0,
  532. iv_load_policy: 3,
  533. rel: 0,
  534. showinfo: 0
  535. },
  536. events: {
  537. onReady: () => {
  538. this.playerReady = true;
  539. let volume = parseInt(
  540. localStorage.getItem("volume")
  541. );
  542. volume = typeof volume === "number" ? volume : 20;
  543. this.player.setVolume(volume);
  544. if (volume > 0) {
  545. this.player.unMute();
  546. }
  547. if (this.muted) this.player.mute();
  548. this.playVideo();
  549. },
  550. onError: err => {
  551. console.log("iframe error", err);
  552. this.voteSkipStation();
  553. },
  554. onStateChange: event => {
  555. if (
  556. event.data === window.YT.PlayerState.PLAYING &&
  557. this.videoLoading === true
  558. ) {
  559. this.videoLoading = false;
  560. this.player.seekTo(
  561. this.getTimeElapsed() / 1000 +
  562. this.currentSong.skipDuration,
  563. true
  564. );
  565. if (this.paused) this.player.pauseVideo();
  566. } else if (
  567. event.data === window.YT.PlayerState.PLAYING &&
  568. this.paused
  569. ) {
  570. this.player.seekTo(
  571. this.timeBeforePause / 1000,
  572. true
  573. );
  574. this.player.pauseVideo();
  575. } else if (
  576. event.data === window.YT.PlayerState.PLAYING &&
  577. this.seeking === true
  578. ) {
  579. this.seeking = false;
  580. }
  581. if (
  582. event.data === window.YT.PlayerState.PAUSED &&
  583. !this.paused &&
  584. !this.noSong &&
  585. this.player.getDuration() / 1000 <
  586. this.currentSong.duration
  587. ) {
  588. this.player.seekTo(
  589. this.getTimeElapsed() / 1000 +
  590. this.currentSong.skipDuration,
  591. true
  592. );
  593. this.player.playVideo();
  594. }
  595. }
  596. }
  597. });
  598. }
  599. },
  600. getTimeElapsed() {
  601. if (this.currentSong) {
  602. let { timePaused } = this;
  603. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  604. return Date.currently() - this.startedAt - timePaused;
  605. }
  606. return 0;
  607. },
  608. playVideo() {
  609. if (this.playerReady) {
  610. this.videoLoading = true;
  611. this.player.loadVideoById(
  612. this.currentSong.songId,
  613. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  614. );
  615. if (window.stationInterval !== 0)
  616. clearInterval(window.stationInterval);
  617. window.stationInterval = setInterval(() => {
  618. this.resizeSeekerbar();
  619. this.calculateTimeElapsed();
  620. }, 150);
  621. }
  622. },
  623. resizeSeekerbar() {
  624. if (!this.paused) {
  625. document.getElementsByClassName(
  626. "seeker-bar"
  627. )[0].style.width = `${parseFloat(
  628. (this.getTimeElapsed() / 1000 / this.currentSong.duration) *
  629. 100
  630. )}%`;
  631. }
  632. },
  633. calculateTimeElapsed() {
  634. if (
  635. this.playerReady &&
  636. this.currentSong &&
  637. this.player.getPlayerState() === -1
  638. ) {
  639. if (this.attemptsToPlayVideo >= 5) {
  640. if (
  641. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  642. 2000
  643. ) {
  644. this.lastTimeRequestedIfCanAutoplay = Date.now();
  645. window.canAutoplay.video().then(({ result }) => {
  646. if (result) {
  647. this.attemptsToPlayVideo = 0;
  648. this.canAutoplay = true;
  649. } else {
  650. this.canAutoplay = false;
  651. }
  652. });
  653. }
  654. } else {
  655. this.player.playVideo();
  656. this.attemptsToPlayVideo += 1;
  657. }
  658. }
  659. if (!this.paused) {
  660. const timeElapsed = this.getTimeElapsed();
  661. const currentPlayerTime = this.player.getCurrentTime() * 1000;
  662. const difference = timeElapsed - currentPlayerTime;
  663. // console.log(difference);
  664. let playbackRate = 1;
  665. if (difference < -2000) {
  666. if (!this.seeking) {
  667. this.seeking = true;
  668. this.player.seekTo(
  669. this.getTimeElapsed() / 1000 +
  670. this.currentSong.skipDuration
  671. );
  672. }
  673. } else if (difference < -200) {
  674. // console.log("Difference0.8");
  675. playbackRate = 0.8;
  676. } else if (difference < -50) {
  677. // console.log("Difference0.9");
  678. playbackRate = 0.9;
  679. } else if (difference < -25) {
  680. // console.log("Difference0.99");
  681. playbackRate = 0.95;
  682. } else if (difference > 2000) {
  683. if (!this.seeking) {
  684. this.seeking = true;
  685. this.player.seekTo(
  686. this.getTimeElapsed() / 1000 +
  687. this.currentSong.skipDuration
  688. );
  689. }
  690. } else if (difference > 200) {
  691. // console.log("Difference1.2");
  692. playbackRate = 1.2;
  693. } else if (difference > 50) {
  694. // console.log("Difference1.1");
  695. playbackRate = 1.1;
  696. } else if (difference > 25) {
  697. // console.log("Difference1.01");
  698. playbackRate = 1.05;
  699. } else if (this.player.getPlaybackRate !== 1.0) {
  700. // console.log("NDifference1.0");
  701. this.player.setPlaybackRate(1.0);
  702. }
  703. if (this.playbackRate !== playbackRate) {
  704. this.player.setPlaybackRate(playbackRate);
  705. this.playbackRate = playbackRate;
  706. }
  707. }
  708. /* if (this.currentTime !== undefined && this.paused) {
  709. this.timePaused += Date.currently() - this.currentTime;
  710. this.currentTime = undefined;
  711. } */
  712. let { timePaused } = this;
  713. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  714. const duration =
  715. (Date.currently() - this.startedAt - timePaused) / 1000;
  716. const songDuration = this.currentSong.duration;
  717. if (songDuration <= duration) this.player.pauseVideo();
  718. if (!this.paused && duration <= songDuration)
  719. this.timeElapsed = utils.formatTime(duration);
  720. },
  721. toggleLock() {
  722. window.socket.emit("stations.toggleLock", this.station._id, res => {
  723. if (res.status === "success") {
  724. new Toast({
  725. content: "Successfully toggled the queue lock.",
  726. timeout: 4000
  727. });
  728. } else new Toast({ content: res.message, timeout: 8000 });
  729. });
  730. },
  731. changeVolume() {
  732. const volume = this.volumeSliderValue;
  733. localStorage.setItem("volume", volume / 100);
  734. if (this.playerReady) {
  735. this.player.setVolume(volume / 100);
  736. if (volume > 0) {
  737. this.player.unMute();
  738. localStorage.setItem("muted", false);
  739. this.muted = false;
  740. }
  741. }
  742. },
  743. resumeLocalStation() {
  744. this.updatePaused(false);
  745. if (!this.noSong) {
  746. if (this.playerReady) {
  747. this.player.seekTo(
  748. this.getTimeElapsed() / 1000 +
  749. this.currentSong.skipDuration
  750. );
  751. this.player.playVideo();
  752. }
  753. }
  754. },
  755. pauseLocalStation() {
  756. this.updatePaused(true);
  757. if (!this.noSong) {
  758. this.timeBeforePause = this.getTimeElapsed();
  759. if (this.playerReady) this.player.pauseVideo();
  760. }
  761. },
  762. skipStation() {
  763. this.socket.emit("stations.forceSkip", this.station._id, data => {
  764. if (data.status !== "success")
  765. new Toast({
  766. content: `Error: ${data.message}`,
  767. timeout: 8000
  768. });
  769. else
  770. new Toast({
  771. content:
  772. "Successfully skipped the station's current song.",
  773. timeout: 4000
  774. });
  775. });
  776. },
  777. voteSkipStation() {
  778. this.socket.emit("stations.voteSkip", this.station._id, data => {
  779. if (data.status !== "success")
  780. new Toast({
  781. content: `Error: ${data.message}`,
  782. timeout: 8000
  783. });
  784. else
  785. new Toast({
  786. content: "Successfully voted to skip the current song.",
  787. timeout: 4000
  788. });
  789. });
  790. },
  791. resumeStation() {
  792. this.socket.emit("stations.resume", this.station._id, data => {
  793. if (data.status !== "success")
  794. new Toast({
  795. content: `Error: ${data.message}`,
  796. timeout: 8000
  797. });
  798. else
  799. new Toast({
  800. content: "Successfully resumed the station.",
  801. timeout: 4000
  802. });
  803. });
  804. },
  805. pauseStation() {
  806. this.socket.emit("stations.pause", this.station._id, data => {
  807. if (data.status !== "success")
  808. new Toast({
  809. content: `Error: ${data.message}`,
  810. timeout: 8000
  811. });
  812. else
  813. new Toast({
  814. content: "Successfully paused the station.",
  815. timeout: 4000
  816. });
  817. });
  818. },
  819. toggleMute() {
  820. if (this.playerReady) {
  821. const previousVolume = parseFloat(
  822. localStorage.getItem("volume")
  823. );
  824. const volume =
  825. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  826. this.muted = !this.muted;
  827. localStorage.setItem("muted", this.muted);
  828. this.volumeSliderValue = volume * 100;
  829. this.player.setVolume(volume);
  830. if (!this.muted) localStorage.setItem("volume", volume);
  831. }
  832. },
  833. increaseVolume() {
  834. if (this.playerReady) {
  835. const previousVolume = parseInt(localStorage.getItem("volume"));
  836. let volume = previousVolume + 5;
  837. if (previousVolume === 0) {
  838. this.muted = false;
  839. localStorage.setItem("muted", false);
  840. }
  841. if (volume > 100) volume = 100;
  842. this.volumeSliderValue = volume * 100;
  843. this.player.setVolume(volume);
  844. localStorage.setItem("volume", volume);
  845. }
  846. },
  847. toggleLike() {
  848. if (this.liked)
  849. this.socket.emit(
  850. "songs.unlike",
  851. this.currentSong.songId,
  852. data => {
  853. if (data.status !== "success")
  854. new Toast({
  855. content: `Error: ${data.message}`,
  856. timeout: 8000
  857. });
  858. }
  859. );
  860. else
  861. this.socket.emit(
  862. "songs.like",
  863. this.currentSong.songId,
  864. data => {
  865. if (data.status !== "success")
  866. new Toast({
  867. content: `Error: ${data.message}`,
  868. timeout: 8000
  869. });
  870. }
  871. );
  872. },
  873. toggleDislike() {
  874. if (this.disliked)
  875. return this.socket.emit(
  876. "songs.undislike",
  877. this.currentSong.songId,
  878. data => {
  879. if (data.status !== "success")
  880. new Toast({
  881. content: `Error: ${data.message}`,
  882. timeout: 8000
  883. });
  884. }
  885. );
  886. return this.socket.emit(
  887. "songs.dislike",
  888. this.currentSong.songId,
  889. data => {
  890. if (data.status !== "success")
  891. new Toast({
  892. content: `Error: ${data.message}`,
  893. timeout: 8000
  894. });
  895. }
  896. );
  897. },
  898. addFirstPrivatePlaylistSongToQueue() {
  899. let isInQueue = false;
  900. if (
  901. this.station.type === "community" &&
  902. this.station.partyMode === true
  903. ) {
  904. this.songsList.forEach(queueSong => {
  905. if (queueSong.requestedBy === this.userId) isInQueue = true;
  906. });
  907. if (!isInQueue && this.privatePlaylistQueueSelected) {
  908. this.socket.emit(
  909. "playlists.getFirstSong",
  910. this.privatePlaylistQueueSelected,
  911. data => {
  912. if (data.status === "success") {
  913. if (data.song) {
  914. if (data.song.duration < 15 * 60) {
  915. this.automaticallyRequestedSongId =
  916. data.song.songId;
  917. this.socket.emit(
  918. "stations.addToQueue",
  919. this.station._id,
  920. data.song.songId,
  921. data2 => {
  922. if (
  923. data2.status === "success"
  924. ) {
  925. this.socket.emit(
  926. "playlists.moveSongToBottom",
  927. this
  928. .privatePlaylistQueueSelected,
  929. data.song.songId,
  930. data3 => {
  931. if (
  932. data3.status ===
  933. "success"
  934. ) {} // eslint-disable-line
  935. }
  936. );
  937. }
  938. }
  939. );
  940. } else {
  941. new Toast({
  942. content: `Top song in playlist was too long to be added.`,
  943. timeout: 3000
  944. });
  945. this.socket.emit(
  946. "playlists.moveSongToBottom",
  947. this.privatePlaylistQueueSelected,
  948. data.song.songId,
  949. data3 => {
  950. if (
  951. data3.status === "success"
  952. ) {
  953. setTimeout(() => {
  954. this.addFirstPrivatePlaylistSongToQueue();
  955. }, 3000);
  956. }
  957. }
  958. );
  959. }
  960. } else {
  961. new Toast({
  962. content: `Selected playlist has no songs.`,
  963. timeout: 4000
  964. });
  965. }
  966. }
  967. }
  968. );
  969. }
  970. }
  971. },
  972. join() {
  973. this.socket.emit("stations.join", this.stationName, res => {
  974. if (res.status === "success") {
  975. this.loading = false;
  976. const {
  977. _id,
  978. displayName,
  979. description,
  980. privacy,
  981. locked,
  982. partyMode,
  983. owner,
  984. privatePlaylist,
  985. type
  986. } = res.data;
  987. this.joinStation({
  988. _id,
  989. name: this.stationName,
  990. displayName,
  991. description,
  992. privacy,
  993. locked,
  994. partyMode,
  995. owner,
  996. privatePlaylist,
  997. type
  998. });
  999. const currentSong = res.data.currentSong
  1000. ? res.data.currentSong
  1001. : {};
  1002. if (currentSong.artists)
  1003. currentSong.artists = currentSong.artists.join(", ");
  1004. this.updateCurrentSong(currentSong);
  1005. this.startedAt = res.data.startedAt;
  1006. this.updatePaused(res.data.paused);
  1007. this.timePaused = res.data.timePaused;
  1008. this.updateUserCount(res.data.userCount);
  1009. this.updateUsers(res.data.users);
  1010. this.pausedAt = res.data.pausedAt;
  1011. if (res.data.currentSong) {
  1012. this.updateNoSong(false);
  1013. this.youtubeReady();
  1014. this.playVideo();
  1015. this.socket.emit(
  1016. "songs.getOwnSongRatings",
  1017. res.data.currentSong.songId,
  1018. data => {
  1019. if (this.currentSong.songId === data.songId) {
  1020. this.liked = data.liked;
  1021. this.disliked = data.disliked;
  1022. }
  1023. }
  1024. );
  1025. } else {
  1026. if (this.playerReady) this.player.pauseVideo();
  1027. this.updateNoSong(true);
  1028. }
  1029. if (type === "community" && partyMode === true) {
  1030. this.socket.emit("stations.getQueue", _id, res => {
  1031. if (res.status === "success") {
  1032. this.updateSongsList(res.queue);
  1033. }
  1034. });
  1035. }
  1036. if (this.isOwnerOrAdmin()) {
  1037. keyboardShortcuts.registerShortcut(
  1038. "station.pauseResume",
  1039. {
  1040. keyCode: 32,
  1041. shift: false,
  1042. ctrl: true,
  1043. handler: () => {
  1044. if (this.paused) this.resumeStation();
  1045. else this.pauseStation();
  1046. }
  1047. }
  1048. );
  1049. keyboardShortcuts.registerShortcut(
  1050. "station.skipStation",
  1051. {
  1052. keyCode: 39,
  1053. shift: false,
  1054. ctrl: true,
  1055. handler: () => {
  1056. this.skipStation();
  1057. }
  1058. }
  1059. );
  1060. }
  1061. keyboardShortcuts.registerShortcut(
  1062. "station.lowerVolumeLarge",
  1063. {
  1064. keyCode: 40,
  1065. shift: false,
  1066. ctrl: true,
  1067. handler: () => {
  1068. this.volumeSliderValue -= 1000;
  1069. this.changeVolume();
  1070. }
  1071. }
  1072. );
  1073. keyboardShortcuts.registerShortcut(
  1074. "station.lowerVolumeSmall",
  1075. {
  1076. keyCode: 40,
  1077. shift: true,
  1078. ctrl: true,
  1079. handler: () => {
  1080. this.volumeSliderValue -= 100;
  1081. this.changeVolume();
  1082. }
  1083. }
  1084. );
  1085. keyboardShortcuts.registerShortcut(
  1086. "station.increaseVolumeLarge",
  1087. {
  1088. keyCode: 38,
  1089. shift: false,
  1090. ctrl: true,
  1091. handler: () => {
  1092. this.volumeSliderValue += 1000;
  1093. this.changeVolume();
  1094. }
  1095. }
  1096. );
  1097. keyboardShortcuts.registerShortcut(
  1098. "station.increaseVolumeSmall",
  1099. {
  1100. keyCode: 38,
  1101. shift: true,
  1102. ctrl: true,
  1103. handler: () => {
  1104. this.volumeSliderValue += 100;
  1105. this.changeVolume();
  1106. }
  1107. }
  1108. );
  1109. // UNIX client time before ping
  1110. const beforePing = Date.now();
  1111. this.socket.emit("apis.ping", pong => {
  1112. // UNIX client time after ping
  1113. const afterPing = Date.now();
  1114. // Average time in MS it took between the server responding and the client receiving
  1115. const connectionLatency = (afterPing - beforePing) / 2;
  1116. console.log(connectionLatency, beforePing - afterPing);
  1117. // UNIX server time
  1118. const serverDate = pong.date;
  1119. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1120. const difference =
  1121. serverDate + connectionLatency - afterPing;
  1122. console.log("Difference: ", difference);
  1123. if (difference > 3000 || difference < -3000) {
  1124. console.log(
  1125. "System time difference is bigger than 3 seconds."
  1126. );
  1127. }
  1128. this.systemDifference = difference;
  1129. });
  1130. } else {
  1131. this.loading = false;
  1132. this.exists = false;
  1133. }
  1134. });
  1135. },
  1136. ...mapActions("sidebars", ["toggleSidebar"]),
  1137. ...mapActions("modals", ["openModal"]),
  1138. ...mapActions("station", [
  1139. "joinStation",
  1140. "updateUserCount",
  1141. "updateUsers",
  1142. "updateCurrentSong",
  1143. "updatePreviousSong",
  1144. "updateSongsList",
  1145. "updatePaused",
  1146. "updateNoSong"
  1147. ])
  1148. },
  1149. mounted() {
  1150. Date.currently = () => {
  1151. return new Date().getTime() + this.systemDifference;
  1152. };
  1153. this.stationName = this.$route.params.id;
  1154. window.stationInterval = 0;
  1155. io.getSocket(socket => {
  1156. this.socket = socket;
  1157. io.removeAllListeners();
  1158. if (this.socket.connected) this.join();
  1159. io.onConnect(this.join);
  1160. this.socket.emit("stations.existsByName", this.stationName, res => {
  1161. if (res.status === "failure" || !res.exists) {
  1162. this.loading = false;
  1163. this.exists = false;
  1164. }
  1165. });
  1166. this.socket.on("event:songs.next", data => {
  1167. const previousSong = this.currentSong.songId
  1168. ? this.currentSong
  1169. : null;
  1170. this.updatePreviousSong(previousSong);
  1171. this.updateCurrentSong(
  1172. data.currentSong ? data.currentSong : {}
  1173. );
  1174. this.startedAt = data.startedAt;
  1175. this.updatePaused(data.paused);
  1176. this.timePaused = data.timePaused;
  1177. if (data.currentSong) {
  1178. this.updateNoSong(false);
  1179. if (this.currentSong.artists)
  1180. this.currentSong.artists = this.currentSong.artists.join(
  1181. ", "
  1182. );
  1183. if (!this.playerReady) this.youtubeReady();
  1184. else this.playVideo();
  1185. this.socket.emit(
  1186. "songs.getOwnSongRatings",
  1187. data.currentSong.songId,
  1188. song => {
  1189. if (this.currentSong.songId === song.songId) {
  1190. this.liked = song.liked;
  1191. this.disliked = song.disliked;
  1192. }
  1193. }
  1194. );
  1195. } else {
  1196. if (this.playerReady) this.player.pauseVideo();
  1197. this.updateNoSong(true);
  1198. }
  1199. let isInQueue = false;
  1200. this.songsList.forEach(queueSong => {
  1201. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1202. });
  1203. if (
  1204. !isInQueue &&
  1205. this.privatePlaylistQueueSelected &&
  1206. (this.automaticallyRequestedSongId !==
  1207. this.currentSong.songId ||
  1208. !this.currentSong.songId)
  1209. ) {
  1210. this.addFirstPrivatePlaylistSongToQueue();
  1211. }
  1212. });
  1213. this.socket.on("event:stations.pause", data => {
  1214. this.pausedAt = data.pausedAt;
  1215. this.pauseLocalStation();
  1216. });
  1217. this.socket.on("event:stations.resume", data => {
  1218. this.timePaused = data.timePaused;
  1219. this.resumeLocalStation();
  1220. });
  1221. this.socket.on("event:stations.remove", () => {
  1222. window.location.href = "/";
  1223. return true;
  1224. });
  1225. this.socket.on("event:song.like", data => {
  1226. if (!this.noSong) {
  1227. if (data.songId === this.currentSong.songId) {
  1228. this.currentSong.dislikes = data.dislikes;
  1229. this.currentSong.likes = data.likes;
  1230. }
  1231. }
  1232. });
  1233. this.socket.on("event:song.dislike", data => {
  1234. if (!this.noSong) {
  1235. if (data.songId === this.currentSong.songId) {
  1236. this.currentSong.dislikes = data.dislikes;
  1237. this.currentSong.likes = data.likes;
  1238. }
  1239. }
  1240. });
  1241. this.socket.on("event:song.unlike", data => {
  1242. if (!this.noSong) {
  1243. if (data.songId === this.currentSong.songId) {
  1244. this.currentSong.dislikes = data.dislikes;
  1245. this.currentSong.likes = data.likes;
  1246. }
  1247. }
  1248. });
  1249. this.socket.on("event:song.undislike", data => {
  1250. if (!this.noSong) {
  1251. if (data.songId === this.currentSong.songId) {
  1252. this.currentSong.dislikes = data.dislikes;
  1253. this.currentSong.likes = data.likes;
  1254. }
  1255. }
  1256. });
  1257. this.socket.on("event:song.newRatings", data => {
  1258. if (!this.noSong) {
  1259. if (data.songId === this.currentSong.songId) {
  1260. this.liked = data.liked;
  1261. this.disliked = data.disliked;
  1262. }
  1263. }
  1264. });
  1265. this.socket.on("event:queue.update", queue => {
  1266. if (this.station.type === "community")
  1267. this.updateSongsList(queue);
  1268. });
  1269. this.socket.on("event:song.voteSkipSong", () => {
  1270. if (this.currentSong) this.currentSong.skipVotes += 1;
  1271. });
  1272. this.socket.on("event:privatePlaylist.selected", playlistId => {
  1273. if (this.station.type === "community") {
  1274. this.station.privatePlaylist = playlistId;
  1275. }
  1276. });
  1277. this.socket.on("event:partyMode.updated", partyMode => {
  1278. if (this.station.type === "community") {
  1279. this.station.partyMode = partyMode;
  1280. }
  1281. });
  1282. this.socket.on("event:newOfficialPlaylist", playlist => {
  1283. if (this.station.type === "official") {
  1284. this.updateSongsList(playlist);
  1285. }
  1286. });
  1287. this.socket.on("event:users.updated", users => {
  1288. this.updateUsers(users);
  1289. });
  1290. this.socket.on("event:userCount.updated", userCount => {
  1291. this.updateUserCount(userCount);
  1292. });
  1293. this.socket.on("event:queueLockToggled", locked => {
  1294. this.station.locked = locked;
  1295. });
  1296. });
  1297. if (JSON.parse(localStorage.getItem("muted"))) {
  1298. this.muted = true;
  1299. this.player.setVolume(0);
  1300. this.volumeSliderValue = 0 * 100;
  1301. } else {
  1302. let volume = parseFloat(localStorage.getItem("volume"));
  1303. volume =
  1304. typeof volume === "number" && !Number.isNaN(volume)
  1305. ? volume
  1306. : 20;
  1307. localStorage.setItem("volume", volume);
  1308. this.volumeSliderValue = volume * 100;
  1309. }
  1310. },
  1311. beforeDestroy() {
  1312. const shortcutNames = [
  1313. "station.pauseResume",
  1314. "station.skipStation",
  1315. "station.lowerVolumeLarge",
  1316. "station.lowerVolumeSmall",
  1317. "station.increaseVolumeLarge",
  1318. "station.increaseVolumeSmall"
  1319. ];
  1320. shortcutNames.forEach(shortcutName => {
  1321. keyboardShortcuts.unregisterShortcut(shortcutName);
  1322. });
  1323. },
  1324. components: {
  1325. StationHeader,
  1326. SongQueue: () => import("../Modals/AddSongToQueue.vue"),
  1327. AddToPlaylist: () => import("../Modals/AddSongToPlaylist.vue"),
  1328. EditPlaylist: () => import("../Modals/Playlists/Edit.vue"),
  1329. CreatePlaylist: () => import("../Modals/Playlists/Create.vue"),
  1330. EditStation: () => import("../Modals/EditStation.vue"),
  1331. Report: () => import("../Modals/Report.vue"),
  1332. SongsListSidebar: () => import("../Sidebars/SongsList.vue"),
  1333. PlaylistSidebar: () => import("../Sidebars/Playlist.vue"),
  1334. UsersSidebar: () => import("../Sidebars/UsersList.vue"),
  1335. UserIdToUsername,
  1336. Z404
  1337. }
  1338. };
  1339. </script>
  1340. <style lang="scss">
  1341. @import "styles/global.scss";
  1342. .station-parent {
  1343. display: flex;
  1344. flex: 1;
  1345. overflow-x: hidden;
  1346. }
  1347. .night-mode {
  1348. .nav,
  1349. .control-sidebar {
  1350. background-color: #222;
  1351. }
  1352. }
  1353. .player-can-not-autoplay {
  1354. position: absolute;
  1355. width: 100%;
  1356. height: 100%;
  1357. background: rgba(3, 169, 244, 0.95);
  1358. display: flex;
  1359. align-items: center;
  1360. justify-content: center;
  1361. p {
  1362. color: $white;
  1363. font-size: 26px;
  1364. text-align: center;
  1365. }
  1366. }
  1367. // Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
  1368. .slide-outer-enter {
  1369. margin-right: -300px;
  1370. }
  1371. // 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.
  1372. .slide-outer-enter-active {
  1373. transition: all 0.3s linear;
  1374. }
  1375. // 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.
  1376. .slide-outer-enter-to {
  1377. margin-right: 0;
  1378. }
  1379. // Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
  1380. .slide-outer-leave {
  1381. margin-right: 0;
  1382. }
  1383. // 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.
  1384. .slide-outer-leave-active {
  1385. transition: all 0.3s linear;
  1386. }
  1387. // 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.
  1388. .slide-outer-leave-to {
  1389. margin-right: -300px;
  1390. }
  1391. // Starting state for enter. Added before element is inserted, removed one frame after element is inserted.
  1392. .slide-inner-enter {
  1393. transform: translateX(300px);
  1394. }
  1395. // 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.
  1396. .slide-inner-enter-active {
  1397. transition: all 0.3s linear;
  1398. z-index: 5;
  1399. }
  1400. // 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.
  1401. .slide-inner-enter-to {
  1402. transform: translateX(0px);
  1403. }
  1404. // Starting state for leave. Added immediately when a leaving transition is triggered, removed after one frame.
  1405. .slide-inner-leave {
  1406. transform: translateX(0px);
  1407. }
  1408. // 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.
  1409. .slide-inner-leave-active {
  1410. transition: all 0.3s linear;
  1411. z-index: 0;
  1412. }
  1413. // 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.
  1414. .slide-inner-leave-to {
  1415. transform: translateX(300px);
  1416. }
  1417. .sidebar-container {
  1418. width: 300px;
  1419. max-width: 300px;
  1420. // background-color: blue;
  1421. position: relative;
  1422. }
  1423. .sidebar {
  1424. position: absolute;
  1425. // z-index: 1;
  1426. top: 0;
  1427. right: 0;
  1428. width: 300px;
  1429. height: 100%;
  1430. background-color: $white;
  1431. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1432. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1433. }
  1434. .no-song {
  1435. color: $primary-color;
  1436. text-align: center;
  1437. }
  1438. .volumeSlider {
  1439. padding: 0 15px;
  1440. background: transparent;
  1441. }
  1442. .volume-slider-wrapper {
  1443. margin-top: 0;
  1444. position: relative;
  1445. display: flex;
  1446. align-items: center;
  1447. .material-icons {
  1448. user-select: none;
  1449. }
  1450. }
  1451. .material-icons {
  1452. cursor: pointer;
  1453. }
  1454. .stationDisplayName {
  1455. color: $white !important;
  1456. }
  1457. .add-to-playlist {
  1458. display: flex;
  1459. align-items: center;
  1460. justify-content: center;
  1461. }
  1462. // .slideout {
  1463. // top: 50px;
  1464. // height: 100%;
  1465. // position: fixed;
  1466. // right: 0;
  1467. // width: 350px;
  1468. // background-color: $white;
  1469. // box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1470. // 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1471. // .slideout-header {
  1472. // text-align: center;
  1473. // background-color: rgb(3, 169, 244) !important;
  1474. // margin: 0;
  1475. // padding-top: 5px;
  1476. // padding-bottom: 7px;
  1477. // color: $white;
  1478. // }
  1479. // .slideout-content {
  1480. // height: 100%;
  1481. // }
  1482. // }
  1483. .modal-large {
  1484. width: 75%;
  1485. }
  1486. .station {
  1487. padding-top: 0.5vw;
  1488. transition: all 0.1s;
  1489. margin: 0 auto;
  1490. flex: 0.9;
  1491. @media only screen and (min-width: 993px) {
  1492. flex: 0.7;
  1493. }
  1494. @media only screen and (min-width: 601px) {
  1495. flex: 0.85;
  1496. }
  1497. @media (min-width: 999px) {
  1498. .mobile-only {
  1499. display: none;
  1500. }
  1501. .desktop-only {
  1502. display: block;
  1503. }
  1504. }
  1505. @media (max-width: 998px) {
  1506. .mobile-only {
  1507. display: block;
  1508. }
  1509. .desktop-only {
  1510. display: none;
  1511. visibility: hidden;
  1512. }
  1513. }
  1514. .mobile-only {
  1515. text-align: center;
  1516. }
  1517. .playlistCard {
  1518. margin: 10px;
  1519. position: relative;
  1520. padding-bottom: calc(31.25% + 7px);
  1521. height: 0;
  1522. overflow-y: scroll;
  1523. .title {
  1524. background-color: rgb(3, 169, 244);
  1525. text-align: center;
  1526. padding: 10px;
  1527. color: $white;
  1528. font-weight: 600;
  1529. }
  1530. .media {
  1531. padding: 0 25px;
  1532. }
  1533. .media-content .content {
  1534. min-height: 64px;
  1535. max-height: 64px;
  1536. display: flex;
  1537. align-items: center;
  1538. }
  1539. .content p strong {
  1540. word-break: break-word;
  1541. }
  1542. .content p small {
  1543. word-break: break-word;
  1544. }
  1545. .add-to-queue {
  1546. width: 100%;
  1547. margin-top: 25px;
  1548. height: 40px;
  1549. border-radius: 0;
  1550. background: rgb(3, 169, 244);
  1551. color: $white !important;
  1552. border: 0;
  1553. &:active,
  1554. &:focus {
  1555. border: 0;
  1556. }
  1557. }
  1558. .add-to-queue:focus {
  1559. background: $primary-color;
  1560. }
  1561. .media-right {
  1562. line-height: 64px;
  1563. }
  1564. .songTitle {
  1565. word-wrap: break-word;
  1566. overflow: hidden;
  1567. text-overflow: ellipsis;
  1568. display: -webkit-box;
  1569. -webkit-box-orient: vertical;
  1570. -webkit-line-clamp: 2;
  1571. line-height: 20px;
  1572. max-height: 40px;
  1573. width: 100%;
  1574. }
  1575. }
  1576. input[type="range"] {
  1577. -webkit-appearance: none;
  1578. width: 100%;
  1579. margin: 7.3px 0;
  1580. }
  1581. input[type="range"]:focus {
  1582. outline: none;
  1583. }
  1584. input[type="range"]::-webkit-slider-runnable-track {
  1585. width: 100%;
  1586. height: 5.2px;
  1587. cursor: pointer;
  1588. box-shadow: 0;
  1589. background: $light-grey-2;
  1590. border-radius: 0;
  1591. border: 0;
  1592. }
  1593. input[type="range"]::-webkit-slider-thumb {
  1594. box-shadow: 0;
  1595. border: 0;
  1596. height: 19px;
  1597. width: 19px;
  1598. border-radius: 15px;
  1599. background: $primary-color;
  1600. cursor: pointer;
  1601. -webkit-appearance: none;
  1602. margin-top: -6.5px;
  1603. }
  1604. input[type="range"]::-moz-range-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"]::-moz-range-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"]::-ms-track {
  1625. width: 100%;
  1626. height: 5.2px;
  1627. cursor: pointer;
  1628. box-shadow: 0;
  1629. background: $light-grey-2;
  1630. border-radius: 1.3px;
  1631. }
  1632. input[type="range"]::-ms-fill-lower {
  1633. background: $light-grey-2;
  1634. border: 0;
  1635. border-radius: 0;
  1636. box-shadow: 0;
  1637. }
  1638. input[type="range"]::-ms-fill-upper {
  1639. background: $light-grey-2;
  1640. border: 0;
  1641. border-radius: 0;
  1642. box-shadow: 0;
  1643. }
  1644. input[type="range"]::-ms-thumb {
  1645. box-shadow: 0;
  1646. border: 0;
  1647. height: 15px;
  1648. width: 15px;
  1649. border-radius: 15px;
  1650. background: $primary-color;
  1651. cursor: pointer;
  1652. -webkit-appearance: none;
  1653. margin-top: 1.5px;
  1654. }
  1655. .video-container {
  1656. position: relative;
  1657. padding-bottom: 56.25%;
  1658. height: 0;
  1659. overflow: hidden;
  1660. iframe {
  1661. position: absolute;
  1662. top: 0;
  1663. left: 0;
  1664. width: 100%;
  1665. height: 100%;
  1666. }
  1667. }
  1668. .video-col {
  1669. padding-right: 0.75rem;
  1670. padding-left: 0.75rem;
  1671. }
  1672. }
  1673. .room-title {
  1674. left: 50%;
  1675. -webkit-transform: translateX(-50%);
  1676. transform: translateX(-50%);
  1677. font-size: 2.1em;
  1678. }
  1679. #ratings {
  1680. display: flex;
  1681. justify-content: flex-end;
  1682. span {
  1683. font-size: 1.68rem;
  1684. }
  1685. i {
  1686. color: #9e9e9e !important;
  1687. cursor: pointer;
  1688. transition: 0.1s color;
  1689. }
  1690. }
  1691. #time-display {
  1692. margin-top: 30px;
  1693. float: right;
  1694. }
  1695. #thumbs_up:hover,
  1696. #thumbs_up.liked {
  1697. color: $green !important;
  1698. }
  1699. #thumbs_down:hover,
  1700. #thumbs_down.disliked {
  1701. color: $red !important;
  1702. }
  1703. #song-thumbnail {
  1704. max-width: 100%;
  1705. width: 85%;
  1706. }
  1707. .seeker-bar-container {
  1708. position: relative;
  1709. height: 7px;
  1710. display: block;
  1711. width: 100%;
  1712. overflow: hidden;
  1713. }
  1714. .seeker-bar {
  1715. top: 0;
  1716. left: 0;
  1717. bottom: 0;
  1718. position: absolute;
  1719. }
  1720. ul {
  1721. list-style: none;
  1722. margin: 0;
  1723. display: block;
  1724. }
  1725. h1,
  1726. h2,
  1727. h3,
  1728. h4,
  1729. h5,
  1730. h6 {
  1731. font-weight: 400;
  1732. line-height: 1.1;
  1733. }
  1734. h1 a,
  1735. h2 a,
  1736. h3 a,
  1737. h4 a,
  1738. h5 a,
  1739. h6 a {
  1740. font-weight: inherit;
  1741. }
  1742. h1 {
  1743. font-size: 4.2rem;
  1744. line-height: 110%;
  1745. margin: 2.1rem 0 1.68rem 0;
  1746. }
  1747. h2 {
  1748. font-size: 3.56rem;
  1749. line-height: 110%;
  1750. margin: 1.78rem 0 1.424rem 0;
  1751. }
  1752. h3 {
  1753. font-size: 2.92rem;
  1754. line-height: 110%;
  1755. margin: 1.46rem 0 1.168rem 0;
  1756. }
  1757. h4 {
  1758. font-size: 2.28rem;
  1759. line-height: 110%;
  1760. margin: 1.14rem 0 0.912rem 0;
  1761. }
  1762. h5 {
  1763. font-size: 1.64rem;
  1764. line-height: 110%;
  1765. margin: 0.82rem 0 0.656rem 0;
  1766. }
  1767. h6 {
  1768. font-size: 1rem;
  1769. line-height: 110%;
  1770. margin: 0.5rem 0 0.4rem 0;
  1771. }
  1772. .thin {
  1773. font-weight: 200;
  1774. }
  1775. .light-blue {
  1776. background-color: $primary-color !important;
  1777. }
  1778. .white {
  1779. background-color: $white !important;
  1780. }
  1781. .btn-search {
  1782. font-size: 14px;
  1783. }
  1784. .menu {
  1785. padding: 0 10px;
  1786. }
  1787. .menu-list li a:hover {
  1788. color: #000 !important;
  1789. }
  1790. .menu-list li {
  1791. display: flex;
  1792. justify-content: space-between;
  1793. }
  1794. .menu-list a {
  1795. /*padding: 0 10px !important;*/
  1796. }
  1797. .menu-list a:hover {
  1798. background-color: transparent;
  1799. }
  1800. .icons-group {
  1801. display: flex;
  1802. }
  1803. #like,
  1804. #dislike {
  1805. position: relative;
  1806. }
  1807. .behind {
  1808. z-index: -1;
  1809. }
  1810. .behind:focus {
  1811. z-index: 0;
  1812. }
  1813. .progress {
  1814. width: 50px;
  1815. animation: rotate 0.8s infinite linear;
  1816. border: 8px solid $primary-color;
  1817. border-right-color: transparent;
  1818. height: 50px;
  1819. position: absolute;
  1820. top: 50%;
  1821. left: 50%;
  1822. }
  1823. @keyframes rotate {
  1824. 0% {
  1825. transform: rotate(0deg);
  1826. }
  1827. 100% {
  1828. transform: rotate(360deg);
  1829. }
  1830. }
  1831. .experimental {
  1832. display: none !important;
  1833. }
  1834. </style>