Station.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792
  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. id="volumeSlider"
  223. type="range"
  224. min="0"
  225. max="10000"
  226. class="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. id="volumeSlider"
  340. type="range"
  341. min="0"
  342. max="10000"
  343. class="active"
  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. export default {
  424. data() {
  425. return {
  426. title: "Station",
  427. loading: true,
  428. ready: false,
  429. exists: true,
  430. playerReady: false,
  431. player: undefined,
  432. timePaused: 0,
  433. muted: false,
  434. timeElapsed: "0:00",
  435. liked: false,
  436. disliked: false,
  437. sidebars: {
  438. songslist: false,
  439. users: false,
  440. playlist: false
  441. },
  442. timeBeforePause: 0,
  443. skipVotes: 0,
  444. privatePlaylistQueueSelected: null,
  445. automaticallyRequestedSongId: null,
  446. systemDifference: 0,
  447. attemptsToPlayVideo: 0,
  448. canAutoplay: true,
  449. lastTimeRequestedIfCanAutoplay: 0,
  450. seeking: false,
  451. playbackRate: 1
  452. };
  453. },
  454. computed: {
  455. ...mapState("modals", {
  456. modals: state => state.modals.station
  457. }),
  458. ...mapState("station", {
  459. station: state => state.station,
  460. currentSong: state => state.currentSong,
  461. songsList: state => state.songsList,
  462. paused: state => state.paused,
  463. noSong: state => state.noSong
  464. }),
  465. ...mapState({
  466. loggedIn: state => state.user.auth.loggedIn,
  467. userId: state => state.user.auth.userId,
  468. role: state => state.user.auth.role
  469. })
  470. },
  471. methods: {
  472. isOwnerOnly() {
  473. return this.loggedIn && this.userId === this.station.owner;
  474. },
  475. isAdminOnly() {
  476. return this.loggedIn && this.role === "admin";
  477. },
  478. removeFromQueue(songId) {
  479. window.socket.emit(
  480. "stations.removeFromQueue",
  481. this.station._id,
  482. songId,
  483. res => {
  484. if (res.status === "success") {
  485. new Toast({
  486. content:
  487. "Successfully removed song from the queue.",
  488. timeout: 4000
  489. });
  490. } else new Toast({ content: res.message, timeout: 8000 });
  491. }
  492. );
  493. },
  494. toggleSidebar(type) {
  495. Object.keys(this.sidebars).forEach(sidebar => {
  496. if (sidebar !== type) this.sidebars[sidebar] = false;
  497. else this.sidebars[type] = !this.sidebars[type];
  498. });
  499. },
  500. youtubeReady() {
  501. if (!this.player) {
  502. this.player = new window.YT.Player("player", {
  503. height: 270,
  504. width: 480,
  505. videoId: this.currentSong.songId,
  506. startSeconds:
  507. this.getTimeElapsed() / 1000 +
  508. this.currentSong.skipDuration,
  509. playerVars: {
  510. controls: 0,
  511. iv_load_policy: 3,
  512. rel: 0,
  513. showinfo: 0
  514. },
  515. events: {
  516. onReady: () => {
  517. this.playerReady = true;
  518. let volume = parseInt(
  519. localStorage.getItem("volume")
  520. );
  521. volume = typeof volume === "number" ? volume : 20;
  522. this.player.setVolume(volume);
  523. if (volume > 0) {
  524. this.player.unMute();
  525. }
  526. if (this.muted) this.player.mute();
  527. this.playVideo();
  528. },
  529. onError: err => {
  530. console.log("iframe error", err);
  531. this.voteSkipStation();
  532. },
  533. onStateChange: event => {
  534. if (
  535. event.data === window.YT.PlayerState.PLAYING &&
  536. this.videoLoading === true
  537. ) {
  538. this.videoLoading = false;
  539. this.player.seekTo(
  540. this.getTimeElapsed() / 1000 +
  541. this.currentSong.skipDuration,
  542. true
  543. );
  544. if (this.paused) this.player.pauseVideo();
  545. } else if (
  546. event.data === window.YT.PlayerState.PLAYING &&
  547. this.paused
  548. ) {
  549. this.player.seekTo(
  550. this.timeBeforePause / 1000,
  551. true
  552. );
  553. this.player.pauseVideo();
  554. } else if (
  555. event.data === window.YT.PlayerState.PLAYING &&
  556. this.seeking === true
  557. ) {
  558. this.seeking = false;
  559. }
  560. if (
  561. event.data === window.YT.PlayerState.PAUSED &&
  562. !this.paused &&
  563. !this.noSong &&
  564. this.player.getDuration() / 1000 <
  565. this.currentSong.duration
  566. ) {
  567. this.player.seekTo(
  568. this.getTimeElapsed() / 1000 +
  569. this.currentSong.skipDuration,
  570. true
  571. );
  572. this.player.playVideo();
  573. }
  574. }
  575. }
  576. });
  577. }
  578. },
  579. getTimeElapsed() {
  580. if (this.currentSong) {
  581. let { timePaused } = this;
  582. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  583. return Date.currently() - this.startedAt - timePaused;
  584. }
  585. return 0;
  586. },
  587. playVideo() {
  588. if (this.playerReady) {
  589. this.videoLoading = true;
  590. this.player.loadVideoById(
  591. this.currentSong.songId,
  592. this.getTimeElapsed() / 1000 + this.currentSong.skipDuration
  593. );
  594. if (window.stationInterval !== 0)
  595. clearInterval(window.stationInterval);
  596. window.stationInterval = setInterval(() => {
  597. this.resizeSeekerbar();
  598. this.calculateTimeElapsed();
  599. }, 150);
  600. }
  601. },
  602. resizeSeekerbar() {
  603. if (!this.paused) {
  604. document.getElementsByClassName(
  605. "seeker-bar"
  606. )[0].style.width = `${parseFloat(
  607. (this.getTimeElapsed() / 1000 / this.currentSong.duration) *
  608. 100
  609. )}%`;
  610. }
  611. },
  612. formatTime(duration) {
  613. if (duration) {
  614. if (duration < 0) return "0:00";
  615. const hours = Math.floor(duration / (60 * 60));
  616. const minutes = Math.floor((duration - hours) / 60);
  617. const seconds = Math.floor(
  618. duration - hours * 60 * 60 - minutes * 60
  619. );
  620. const formatHours = () => {
  621. if (hours > 0) {
  622. if (hours < 10) return `0${hours}:`;
  623. return `${hours}:`;
  624. }
  625. return "";
  626. };
  627. return `${formatHours()}${minutes}:${
  628. seconds < 10 ? `0${seconds}` : seconds
  629. }`;
  630. }
  631. return false;
  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 = this.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 = document.getElementById("volumeSlider").value;
  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. document.getElementById("volumeSlider").value = 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. document.getElementById("volumeSlider").value = 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 (this.station.type === "community") {
  901. this.songsList.forEach(queueSong => {
  902. if (queueSong.requestedBy === this.userId) isInQueue = true;
  903. });
  904. if (!isInQueue && this.privatePlaylistQueueSelected) {
  905. this.socket.emit(
  906. "playlists.getFirstSong",
  907. this.privatePlaylistQueueSelected,
  908. data => {
  909. if (data.status === "success") {
  910. if (data.song.duration < 15 * 60) {
  911. this.automaticallyRequestedSongId =
  912. data.song.songId;
  913. this.socket.emit(
  914. "stations.addToQueue",
  915. this.station._id,
  916. data.song.songId,
  917. data2 => {
  918. if (data2.status === "success") {
  919. this.socket.emit(
  920. "playlists.moveSongToBottom",
  921. this
  922. .privatePlaylistQueueSelected,
  923. data.song.songId,
  924. data3 => {
  925. if (
  926. data3.status ===
  927. "success"
  928. ) {} // eslint-disable-line
  929. }
  930. );
  931. }
  932. }
  933. );
  934. } else {
  935. new Toast({
  936. content: `Top song in playlist was too long to be added.`,
  937. timeout: 3000
  938. });
  939. this.socket.emit(
  940. "playlists.moveSongToBottom",
  941. this.privatePlaylistQueueSelected,
  942. data.song.songId,
  943. data3 => {
  944. if (data3.status === "success") {
  945. setTimeout(() => {
  946. this.addFirstPrivatePlaylistSongToQueue();
  947. }, 3000);
  948. }
  949. }
  950. );
  951. }
  952. }
  953. }
  954. );
  955. }
  956. }
  957. },
  958. join() {
  959. this.socket.emit("stations.join", this.stationName, res => {
  960. if (res.status === "success") {
  961. this.loading = false;
  962. const {
  963. _id,
  964. displayName,
  965. description,
  966. privacy,
  967. locked,
  968. partyMode,
  969. owner,
  970. privatePlaylist,
  971. type
  972. } = res.data;
  973. this.joinStation({
  974. _id,
  975. name: this.stationName,
  976. displayName,
  977. description,
  978. privacy,
  979. locked,
  980. partyMode,
  981. owner,
  982. privatePlaylist,
  983. type
  984. });
  985. const currentSong = res.data.currentSong
  986. ? res.data.currentSong
  987. : {};
  988. if (currentSong.artists)
  989. currentSong.artists = currentSong.artists.join(", ");
  990. this.updateCurrentSong(currentSong);
  991. this.startedAt = res.data.startedAt;
  992. this.updatePaused(res.data.paused);
  993. this.timePaused = res.data.timePaused;
  994. this.updateUserCount(res.data.userCount);
  995. this.updateUsers(res.data.users);
  996. this.pausedAt = res.data.pausedAt;
  997. if (res.data.currentSong) {
  998. this.updateNoSong(false);
  999. this.youtubeReady();
  1000. this.playVideo();
  1001. this.socket.emit(
  1002. "songs.getOwnSongRatings",
  1003. res.data.currentSong.songId,
  1004. data => {
  1005. if (this.currentSong.songId === data.songId) {
  1006. this.liked = data.liked;
  1007. this.disliked = data.disliked;
  1008. }
  1009. }
  1010. );
  1011. } else {
  1012. if (this.playerReady) this.player.pauseVideo();
  1013. this.updateNoSong(true);
  1014. }
  1015. // UNIX client time before ping
  1016. const beforePing = Date.now();
  1017. this.socket.emit("apis.ping", pong => {
  1018. // UNIX client time after ping
  1019. const afterPing = Date.now();
  1020. // Average time in MS it took between the server responding and the client receiving
  1021. const connectionLatency = (afterPing - beforePing) / 2;
  1022. console.log(connectionLatency, beforePing - afterPing);
  1023. // UNIX server time
  1024. const serverDate = pong.date;
  1025. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1026. const difference =
  1027. serverDate + connectionLatency - afterPing;
  1028. console.log("Difference: ", difference);
  1029. if (difference > 3000 || difference < -3000) {
  1030. console.log(
  1031. "System time difference is bigger than 3 seconds."
  1032. );
  1033. }
  1034. this.systemDifference = difference;
  1035. });
  1036. } else {
  1037. this.loading = false;
  1038. this.exists = false;
  1039. }
  1040. });
  1041. },
  1042. ...mapActions("modals", ["openModal"]),
  1043. ...mapActions("station", [
  1044. "joinStation",
  1045. "updateUserCount",
  1046. "updateUsers",
  1047. "updateCurrentSong",
  1048. "updatePreviousSong",
  1049. "updateSongsList",
  1050. "updatePaused",
  1051. "updateNoSong"
  1052. ])
  1053. },
  1054. mounted() {
  1055. Date.currently = () => {
  1056. return new Date().getTime() + this.systemDifference;
  1057. };
  1058. this.stationName = this.$route.params.id;
  1059. window.stationInterval = 0;
  1060. io.getSocket(socket => {
  1061. this.socket = socket;
  1062. io.removeAllListeners();
  1063. if (this.socket.connected) this.join();
  1064. io.onConnect(this.join);
  1065. this.socket.emit("stations.existsByName", this.stationName, res => {
  1066. if (res.status === "failure" || !res.exists) {
  1067. this.loading = false;
  1068. this.exists = false;
  1069. }
  1070. });
  1071. this.socket.on("event:songs.next", data => {
  1072. const previousSong = this.currentSong.songId
  1073. ? this.currentSong
  1074. : null;
  1075. this.updatePreviousSong(previousSong);
  1076. this.updateCurrentSong(
  1077. data.currentSong ? data.currentSong : {}
  1078. );
  1079. this.startedAt = data.startedAt;
  1080. this.updatePaused(data.paused);
  1081. this.timePaused = data.timePaused;
  1082. if (data.currentSong) {
  1083. this.updateNoSong(false);
  1084. if (this.currentSong.artists)
  1085. this.currentSong.artists = this.currentSong.artists.join(
  1086. ", "
  1087. );
  1088. if (!this.playerReady) this.youtubeReady();
  1089. else this.playVideo();
  1090. this.socket.emit(
  1091. "songs.getOwnSongRatings",
  1092. data.currentSong.songId,
  1093. song => {
  1094. if (this.currentSong.songId === song.songId) {
  1095. this.liked = song.liked;
  1096. this.disliked = song.disliked;
  1097. }
  1098. }
  1099. );
  1100. } else {
  1101. if (this.playerReady) this.player.pauseVideo();
  1102. this.updateNoSong(true);
  1103. }
  1104. let isInQueue = false;
  1105. this.songsList.forEach(queueSong => {
  1106. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1107. });
  1108. if (
  1109. !isInQueue &&
  1110. this.privatePlaylistQueueSelected &&
  1111. (this.automaticallyRequestedSongId !==
  1112. this.currentSong.songId ||
  1113. !this.currentSong.songId)
  1114. ) {
  1115. this.addFirstPrivatePlaylistSongToQueue();
  1116. }
  1117. });
  1118. this.socket.on("event:stations.pause", data => {
  1119. this.pausedAt = data.pausedAt;
  1120. this.pauseLocalStation();
  1121. });
  1122. this.socket.on("event:stations.resume", data => {
  1123. this.timePaused = data.timePaused;
  1124. this.resumeLocalStation();
  1125. });
  1126. this.socket.on("event:stations.remove", () => {
  1127. window.location.href = "/";
  1128. return true;
  1129. });
  1130. this.socket.on("event:song.like", data => {
  1131. if (!this.noSong) {
  1132. if (data.songId === this.currentSong.songId) {
  1133. this.currentSong.dislikes = data.dislikes;
  1134. this.currentSong.likes = data.likes;
  1135. }
  1136. }
  1137. });
  1138. this.socket.on("event:song.dislike", data => {
  1139. if (!this.noSong) {
  1140. if (data.songId === this.currentSong.songId) {
  1141. this.currentSong.dislikes = data.dislikes;
  1142. this.currentSong.likes = data.likes;
  1143. }
  1144. }
  1145. });
  1146. this.socket.on("event:song.unlike", data => {
  1147. if (!this.noSong) {
  1148. if (data.songId === this.currentSong.songId) {
  1149. this.currentSong.dislikes = data.dislikes;
  1150. this.currentSong.likes = data.likes;
  1151. }
  1152. }
  1153. });
  1154. this.socket.on("event:song.undislike", data => {
  1155. if (!this.noSong) {
  1156. if (data.songId === this.currentSong.songId) {
  1157. this.currentSong.dislikes = data.dislikes;
  1158. this.currentSong.likes = data.likes;
  1159. }
  1160. }
  1161. });
  1162. this.socket.on("event:song.newRatings", data => {
  1163. if (!this.noSong) {
  1164. if (data.songId === this.currentSong.songId) {
  1165. this.liked = data.liked;
  1166. this.disliked = data.disliked;
  1167. }
  1168. }
  1169. });
  1170. this.socket.on("event:queue.update", queue => {
  1171. if (this.station.type === "community")
  1172. this.updateSongsList(queue);
  1173. });
  1174. this.socket.on("event:song.voteSkipSong", () => {
  1175. if (this.currentSong) this.currentSong.skipVotes += 1;
  1176. });
  1177. this.socket.on("event:privatePlaylist.selected", playlistId => {
  1178. if (this.station.type === "community") {
  1179. this.station.privatePlaylist = playlistId;
  1180. }
  1181. });
  1182. this.socket.on("event:partyMode.updated", partyMode => {
  1183. if (this.station.type === "community") {
  1184. this.station.partyMode = partyMode;
  1185. }
  1186. });
  1187. this.socket.on("event:newOfficialPlaylist", playlist => {
  1188. if (this.station.type === "official") {
  1189. this.updateSongsList(playlist);
  1190. }
  1191. });
  1192. this.socket.on("event:users.updated", users => {
  1193. this.updateUsers(users);
  1194. });
  1195. this.socket.on("event:userCount.updated", userCount => {
  1196. this.updateUserCount(userCount);
  1197. });
  1198. this.socket.on("event:queueLockToggled", locked => {
  1199. this.station.locked = locked;
  1200. });
  1201. });
  1202. if (JSON.parse(localStorage.getItem("muted"))) {
  1203. this.muted = true;
  1204. this.player.setVolume(0);
  1205. document.getElementById("volumeSlider").value = 0 * 100;
  1206. } else {
  1207. let volume = parseFloat(localStorage.getItem("volume"));
  1208. volume =
  1209. typeof volume === "number" && !Number.isNaN(volume)
  1210. ? volume
  1211. : 20;
  1212. localStorage.setItem("volume", volume);
  1213. document.getElementById("volumeSlider").value = volume * 100;
  1214. }
  1215. },
  1216. components: {
  1217. StationHeader,
  1218. SongQueue: () => import("../Modals/AddSongToQueue.vue"),
  1219. AddToPlaylist: () => import("../Modals/AddSongToPlaylist.vue"),
  1220. EditPlaylist: () => import("../Modals/Playlists/Edit.vue"),
  1221. CreatePlaylist: () => import("../Modals/Playlists/Create.vue"),
  1222. EditStation: () => import("../Modals/EditStation.vue"),
  1223. Report: () => import("../Modals/Report.vue"),
  1224. SongsListSidebar: () => import("../Sidebars/SongsList.vue"),
  1225. PlaylistSidebar: () => import("../Sidebars/Playlist.vue"),
  1226. UsersSidebar: () => import("../Sidebars/UsersList.vue"),
  1227. UserIdToUsername,
  1228. Z404
  1229. }
  1230. };
  1231. </script>
  1232. <style lang="scss">
  1233. @import "styles/global.scss";
  1234. .player-can-not-autoplay {
  1235. position: absolute;
  1236. width: 100%;
  1237. height: 100%;
  1238. background: rgba(3, 169, 244, 0.95);
  1239. display: flex;
  1240. align-items: center;
  1241. justify-content: center;
  1242. p {
  1243. color: $white;
  1244. font-size: 26px;
  1245. text-align: center;
  1246. }
  1247. }
  1248. .slide-enter-active,
  1249. .slide-leave-active {
  1250. transition: all 0.3s ease;
  1251. }
  1252. .slide-enter,
  1253. .slide-leave-to {
  1254. transform: translateX(300px);
  1255. }
  1256. .no-song {
  1257. color: $primary-color;
  1258. text-align: center;
  1259. }
  1260. #volumeSlider {
  1261. padding: 0 15px;
  1262. background: transparent;
  1263. }
  1264. .volume-slider-wrapper {
  1265. margin-top: 0;
  1266. position: relative;
  1267. display: flex;
  1268. align-items: center;
  1269. .material-icons {
  1270. user-select: none;
  1271. }
  1272. }
  1273. .material-icons {
  1274. cursor: pointer;
  1275. }
  1276. .stationDisplayName {
  1277. color: $white !important;
  1278. }
  1279. .add-to-playlist {
  1280. display: flex;
  1281. align-items: center;
  1282. justify-content: center;
  1283. }
  1284. .slideout {
  1285. top: 50px;
  1286. height: 100%;
  1287. position: fixed;
  1288. right: 0;
  1289. width: 350px;
  1290. background-color: $white;
  1291. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1292. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1293. .slideout-header {
  1294. text-align: center;
  1295. background-color: rgb(3, 169, 244) !important;
  1296. margin: 0;
  1297. padding-top: 5px;
  1298. padding-bottom: 7px;
  1299. color: $white;
  1300. }
  1301. .slideout-content {
  1302. height: 100%;
  1303. }
  1304. }
  1305. .modal-large {
  1306. width: 75%;
  1307. }
  1308. .station {
  1309. flex: 1 0 auto;
  1310. padding-top: 0.5vw;
  1311. transition: all 0.1s;
  1312. margin: 0 auto;
  1313. max-width: 100%;
  1314. width: 90%;
  1315. @media only screen and (min-width: 993px) {
  1316. width: 70%;
  1317. }
  1318. @media only screen and (min-width: 601px) {
  1319. width: 85%;
  1320. }
  1321. @media (min-width: 999px) {
  1322. .mobile-only {
  1323. display: none;
  1324. }
  1325. .desktop-only {
  1326. display: block;
  1327. }
  1328. }
  1329. @media (max-width: 998px) {
  1330. .mobile-only {
  1331. display: block;
  1332. }
  1333. .desktop-only {
  1334. display: none;
  1335. visibility: hidden;
  1336. }
  1337. }
  1338. .mobile-only {
  1339. text-align: center;
  1340. }
  1341. .playlistCard {
  1342. margin: 10px;
  1343. position: relative;
  1344. padding-bottom: calc(31.25% + 7px);
  1345. height: 0;
  1346. overflow-y: scroll;
  1347. .title {
  1348. background-color: rgb(3, 169, 244);
  1349. text-align: center;
  1350. padding: 10px;
  1351. color: $white;
  1352. font-weight: 600;
  1353. }
  1354. .media {
  1355. padding: 0 25px;
  1356. }
  1357. .media-content .content {
  1358. min-height: 64px;
  1359. max-height: 64px;
  1360. display: flex;
  1361. align-items: center;
  1362. }
  1363. .content p strong {
  1364. word-break: break-word;
  1365. }
  1366. .content p small {
  1367. word-break: break-word;
  1368. }
  1369. .add-to-queue {
  1370. width: 100%;
  1371. margin-top: 25px;
  1372. height: 40px;
  1373. border-radius: 0;
  1374. background: rgb(3, 169, 244);
  1375. color: $white !important;
  1376. border: 0;
  1377. &:active,
  1378. &:focus {
  1379. border: 0;
  1380. }
  1381. }
  1382. .add-to-queue:focus {
  1383. background: $primary-color;
  1384. }
  1385. .media-right {
  1386. line-height: 64px;
  1387. }
  1388. .songTitle {
  1389. word-wrap: break-word;
  1390. overflow: hidden;
  1391. text-overflow: ellipsis;
  1392. display: -webkit-box;
  1393. -webkit-box-orient: vertical;
  1394. -webkit-line-clamp: 2;
  1395. line-height: 20px;
  1396. max-height: 40px;
  1397. width: 100%;
  1398. }
  1399. }
  1400. input[type="range"] {
  1401. -webkit-appearance: none;
  1402. width: 100%;
  1403. margin: 7.3px 0;
  1404. }
  1405. input[type="range"]:focus {
  1406. outline: none;
  1407. }
  1408. input[type="range"]::-webkit-slider-runnable-track {
  1409. width: 100%;
  1410. height: 5.2px;
  1411. cursor: pointer;
  1412. box-shadow: 0;
  1413. background: $light-grey-2;
  1414. border-radius: 0;
  1415. border: 0;
  1416. }
  1417. input[type="range"]::-webkit-slider-thumb {
  1418. box-shadow: 0;
  1419. border: 0;
  1420. height: 19px;
  1421. width: 19px;
  1422. border-radius: 15px;
  1423. background: $primary-color;
  1424. cursor: pointer;
  1425. -webkit-appearance: none;
  1426. margin-top: -6.5px;
  1427. }
  1428. input[type="range"]::-moz-range-track {
  1429. width: 100%;
  1430. height: 5.2px;
  1431. cursor: pointer;
  1432. box-shadow: 0;
  1433. background: $light-grey-2;
  1434. border-radius: 0;
  1435. border: 0;
  1436. }
  1437. input[type="range"]::-moz-range-thumb {
  1438. box-shadow: 0;
  1439. border: 0;
  1440. height: 19px;
  1441. width: 19px;
  1442. border-radius: 15px;
  1443. background: $primary-color;
  1444. cursor: pointer;
  1445. -webkit-appearance: none;
  1446. margin-top: -6.5px;
  1447. }
  1448. input[type="range"]::-ms-track {
  1449. width: 100%;
  1450. height: 5.2px;
  1451. cursor: pointer;
  1452. box-shadow: 0;
  1453. background: $light-grey-2;
  1454. border-radius: 1.3px;
  1455. }
  1456. input[type="range"]::-ms-fill-lower {
  1457. background: $light-grey-2;
  1458. border: 0;
  1459. border-radius: 0;
  1460. box-shadow: 0;
  1461. }
  1462. input[type="range"]::-ms-fill-upper {
  1463. background: $light-grey-2;
  1464. border: 0;
  1465. border-radius: 0;
  1466. box-shadow: 0;
  1467. }
  1468. input[type="range"]::-ms-thumb {
  1469. box-shadow: 0;
  1470. border: 0;
  1471. height: 15px;
  1472. width: 15px;
  1473. border-radius: 15px;
  1474. background: $primary-color;
  1475. cursor: pointer;
  1476. -webkit-appearance: none;
  1477. margin-top: 1.5px;
  1478. }
  1479. .video-container {
  1480. position: relative;
  1481. padding-bottom: 56.25%;
  1482. height: 0;
  1483. overflow: hidden;
  1484. iframe {
  1485. position: absolute;
  1486. top: 0;
  1487. left: 0;
  1488. width: 100%;
  1489. height: 100%;
  1490. }
  1491. }
  1492. .video-col {
  1493. padding-right: 0.75rem;
  1494. padding-left: 0.75rem;
  1495. }
  1496. }
  1497. .room-title {
  1498. left: 50%;
  1499. -webkit-transform: translateX(-50%);
  1500. transform: translateX(-50%);
  1501. font-size: 2.1em;
  1502. }
  1503. #ratings {
  1504. span {
  1505. font-size: 1.68rem;
  1506. }
  1507. i {
  1508. color: #9e9e9e !important;
  1509. cursor: pointer;
  1510. transition: 0.1s color;
  1511. }
  1512. }
  1513. #time-display {
  1514. margin-top: 30px;
  1515. float: right;
  1516. }
  1517. #thumbs_up:hover,
  1518. #thumbs_up.liked {
  1519. color: $green !important;
  1520. }
  1521. #thumbs_down:hover,
  1522. #thumbs_down.disliked {
  1523. color: $red !important;
  1524. }
  1525. #song-thumbnail {
  1526. max-width: 100%;
  1527. width: 85%;
  1528. }
  1529. .seeker-bar-container {
  1530. position: relative;
  1531. height: 7px;
  1532. display: block;
  1533. width: 100%;
  1534. overflow: hidden;
  1535. }
  1536. .seeker-bar {
  1537. top: 0;
  1538. left: 0;
  1539. bottom: 0;
  1540. position: absolute;
  1541. }
  1542. ul {
  1543. list-style: none;
  1544. margin: 0;
  1545. display: block;
  1546. }
  1547. h1,
  1548. h2,
  1549. h3,
  1550. h4,
  1551. h5,
  1552. h6 {
  1553. font-weight: 400;
  1554. line-height: 1.1;
  1555. }
  1556. h1 a,
  1557. h2 a,
  1558. h3 a,
  1559. h4 a,
  1560. h5 a,
  1561. h6 a {
  1562. font-weight: inherit;
  1563. }
  1564. h1 {
  1565. font-size: 4.2rem;
  1566. line-height: 110%;
  1567. margin: 2.1rem 0 1.68rem 0;
  1568. }
  1569. h2 {
  1570. font-size: 3.56rem;
  1571. line-height: 110%;
  1572. margin: 1.78rem 0 1.424rem 0;
  1573. }
  1574. h3 {
  1575. font-size: 2.92rem;
  1576. line-height: 110%;
  1577. margin: 1.46rem 0 1.168rem 0;
  1578. }
  1579. h4 {
  1580. font-size: 2.28rem;
  1581. line-height: 110%;
  1582. margin: 1.14rem 0 0.912rem 0;
  1583. }
  1584. h5 {
  1585. font-size: 1.64rem;
  1586. line-height: 110%;
  1587. margin: 0.82rem 0 0.656rem 0;
  1588. }
  1589. h6 {
  1590. font-size: 1rem;
  1591. line-height: 110%;
  1592. margin: 0.5rem 0 0.4rem 0;
  1593. }
  1594. .thin {
  1595. font-weight: 200;
  1596. }
  1597. .left {
  1598. float: left !important;
  1599. }
  1600. .right {
  1601. float: right !important;
  1602. }
  1603. .light-blue {
  1604. background-color: $primary-color !important;
  1605. }
  1606. .white {
  1607. background-color: $white !important;
  1608. }
  1609. .btn-search {
  1610. font-size: 14px;
  1611. }
  1612. .menu {
  1613. padding: 0 10px;
  1614. }
  1615. .menu-list li a:hover {
  1616. color: #000 !important;
  1617. }
  1618. .menu-list li {
  1619. display: flex;
  1620. justify-content: space-between;
  1621. }
  1622. .menu-list a {
  1623. /*padding: 0 10px !important;*/
  1624. }
  1625. .menu-list a:hover {
  1626. background-color: transparent;
  1627. }
  1628. .icons-group {
  1629. display: flex;
  1630. }
  1631. #like,
  1632. #dislike {
  1633. position: relative;
  1634. }
  1635. .behind {
  1636. z-index: -1;
  1637. }
  1638. .behind:focus {
  1639. z-index: 0;
  1640. }
  1641. .progress {
  1642. width: 50px;
  1643. animation: rotate 0.8s infinite linear;
  1644. border: 8px solid $primary-color;
  1645. border-right-color: transparent;
  1646. height: 50px;
  1647. position: absolute;
  1648. top: 50%;
  1649. left: 50%;
  1650. }
  1651. @keyframes rotate {
  1652. 0% {
  1653. transform: rotate(0deg);
  1654. }
  1655. 100% {
  1656. transform: rotate(360deg);
  1657. }
  1658. }
  1659. .experimental {
  1660. display: none !important;
  1661. }
  1662. </style>