Station.vue 41 KB

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