Station.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811
  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(originalDuration) {
  613. if (originalDuration) {
  614. if (originalDuration < 0) return "0:00";
  615. let duration = originalDuration;
  616. let hours = Math.floor(duration / (60 * 60));
  617. duration -= hours * 60 * 60;
  618. let minutes = Math.floor(duration / 60);
  619. duration -= minutes * 60;
  620. let seconds = Math.floor(duration);
  621. if (hours === 0) {
  622. hours = "";
  623. }
  624. if (hours > 0) {
  625. if (minutes < 10) minutes = `0${minutes}`;
  626. }
  627. if (seconds < 10) {
  628. seconds = `0${seconds}`;
  629. }
  630. return `${hours}${hours ? ":" : ""}${minutes}:${seconds}`;
  631. }
  632. return false;
  633. },
  634. calculateTimeElapsed() {
  635. if (
  636. this.playerReady &&
  637. this.currentSong &&
  638. this.player.getPlayerState() === -1
  639. ) {
  640. if (this.attemptsToPlayVideo >= 5) {
  641. if (
  642. Date.now() - this.lastTimeRequestedIfCanAutoplay >
  643. 2000
  644. ) {
  645. this.lastTimeRequestedIfCanAutoplay = Date.now();
  646. window.canAutoplay.video().then(({ result }) => {
  647. if (result) {
  648. this.attemptsToPlayVideo = 0;
  649. this.canAutoplay = true;
  650. } else {
  651. this.canAutoplay = false;
  652. }
  653. });
  654. }
  655. } else {
  656. this.player.playVideo();
  657. this.attemptsToPlayVideo += 1;
  658. }
  659. }
  660. if (!this.paused) {
  661. const timeElapsed = this.getTimeElapsed();
  662. const currentPlayerTime = this.player.getCurrentTime() * 1000;
  663. const difference = timeElapsed - currentPlayerTime;
  664. // console.log(difference);
  665. let playbackRate = 1;
  666. if (difference < -2000) {
  667. if (!this.seeking) {
  668. this.seeking = true;
  669. this.player.seekTo(
  670. this.getTimeElapsed() / 1000 +
  671. this.currentSong.skipDuration
  672. );
  673. }
  674. } else if (difference < -200) {
  675. // console.log("Difference0.8");
  676. playbackRate = 0.8;
  677. } else if (difference < -50) {
  678. // console.log("Difference0.9");
  679. playbackRate = 0.9;
  680. } else if (difference < -25) {
  681. // console.log("Difference0.99");
  682. playbackRate = 0.95;
  683. } else if (difference > 2000) {
  684. if (!this.seeking) {
  685. this.seeking = true;
  686. this.player.seekTo(
  687. this.getTimeElapsed() / 1000 +
  688. this.currentSong.skipDuration
  689. );
  690. }
  691. } else if (difference > 200) {
  692. // console.log("Difference1.2");
  693. playbackRate = 1.2;
  694. } else if (difference > 50) {
  695. // console.log("Difference1.1");
  696. playbackRate = 1.1;
  697. } else if (difference > 25) {
  698. // console.log("Difference1.01");
  699. playbackRate = 1.05;
  700. } else if (this.player.getPlaybackRate !== 1.0) {
  701. // console.log("NDifference1.0");
  702. this.player.setPlaybackRate(1.0);
  703. }
  704. if (this.playbackRate !== playbackRate) {
  705. this.player.setPlaybackRate(playbackRate);
  706. this.playbackRate = playbackRate;
  707. }
  708. }
  709. /* if (this.currentTime !== undefined && this.paused) {
  710. this.timePaused += Date.currently() - this.currentTime;
  711. this.currentTime = undefined;
  712. } */
  713. let { timePaused } = this;
  714. if (this.paused) timePaused += Date.currently() - this.pausedAt;
  715. const duration =
  716. (Date.currently() - this.startedAt - timePaused) / 1000;
  717. const songDuration = this.currentSong.duration;
  718. if (songDuration <= duration) this.player.pauseVideo();
  719. if (!this.paused && duration <= songDuration)
  720. this.timeElapsed = this.formatTime(duration);
  721. },
  722. toggleLock() {
  723. window.socket.emit("stations.toggleLock", this.station._id, res => {
  724. if (res.status === "success") {
  725. new Toast({
  726. content: "Successfully toggled the queue lock.",
  727. timeout: 4000
  728. });
  729. } else new Toast({ content: res.message, timeout: 8000 });
  730. });
  731. },
  732. changeVolume() {
  733. const volume = document.getElementById("volumeSlider").value;
  734. localStorage.setItem("volume", volume / 100);
  735. if (this.playerReady) {
  736. this.player.setVolume(volume / 100);
  737. if (volume > 0) {
  738. this.player.unMute();
  739. localStorage.setItem("muted", false);
  740. this.muted = false;
  741. }
  742. }
  743. },
  744. resumeLocalStation() {
  745. this.updatePaused(false);
  746. if (!this.noSong) {
  747. if (this.playerReady) {
  748. this.player.seekTo(
  749. this.getTimeElapsed() / 1000 +
  750. this.currentSong.skipDuration
  751. );
  752. this.player.playVideo();
  753. }
  754. }
  755. },
  756. pauseLocalStation() {
  757. this.updatePaused(true);
  758. if (!this.noSong) {
  759. this.timeBeforePause = this.getTimeElapsed();
  760. if (this.playerReady) this.player.pauseVideo();
  761. }
  762. },
  763. skipStation() {
  764. this.socket.emit("stations.forceSkip", this.station._id, data => {
  765. if (data.status !== "success")
  766. new Toast({
  767. content: `Error: ${data.message}`,
  768. timeout: 8000
  769. });
  770. else
  771. new Toast({
  772. content:
  773. "Successfully skipped the station's current song.",
  774. timeout: 4000
  775. });
  776. });
  777. },
  778. voteSkipStation() {
  779. this.socket.emit("stations.voteSkip", this.station._id, data => {
  780. if (data.status !== "success")
  781. new Toast({
  782. content: `Error: ${data.message}`,
  783. timeout: 8000
  784. });
  785. else
  786. new Toast({
  787. content: "Successfully voted to skip the current song.",
  788. timeout: 4000
  789. });
  790. });
  791. },
  792. resumeStation() {
  793. this.socket.emit("stations.resume", this.station._id, data => {
  794. if (data.status !== "success")
  795. new Toast({
  796. content: `Error: ${data.message}`,
  797. timeout: 8000
  798. });
  799. else
  800. new Toast({
  801. content: "Successfully resumed the station.",
  802. timeout: 4000
  803. });
  804. });
  805. },
  806. pauseStation() {
  807. this.socket.emit("stations.pause", this.station._id, data => {
  808. if (data.status !== "success")
  809. new Toast({
  810. content: `Error: ${data.message}`,
  811. timeout: 8000
  812. });
  813. else
  814. new Toast({
  815. content: "Successfully paused the station.",
  816. timeout: 4000
  817. });
  818. });
  819. },
  820. toggleMute() {
  821. if (this.playerReady) {
  822. const previousVolume = parseFloat(
  823. localStorage.getItem("volume")
  824. );
  825. const volume =
  826. this.player.getVolume() * 100 <= 0 ? previousVolume : 0;
  827. this.muted = !this.muted;
  828. localStorage.setItem("muted", this.muted);
  829. document.getElementById("volumeSlider").value = volume * 100;
  830. this.player.setVolume(volume);
  831. if (!this.muted) localStorage.setItem("volume", volume);
  832. }
  833. },
  834. increaseVolume() {
  835. if (this.playerReady) {
  836. const previousVolume = parseInt(localStorage.getItem("volume"));
  837. let volume = previousVolume + 5;
  838. if (previousVolume === 0) {
  839. this.muted = false;
  840. localStorage.setItem("muted", false);
  841. }
  842. if (volume > 100) volume = 100;
  843. document.getElementById("volumeSlider").value = volume * 100;
  844. this.player.setVolume(volume);
  845. localStorage.setItem("volume", volume);
  846. }
  847. },
  848. toggleLike() {
  849. if (this.liked)
  850. this.socket.emit(
  851. "songs.unlike",
  852. this.currentSong.songId,
  853. data => {
  854. if (data.status !== "success")
  855. new Toast({
  856. content: `Error: ${data.message}`,
  857. timeout: 8000
  858. });
  859. }
  860. );
  861. else
  862. this.socket.emit(
  863. "songs.like",
  864. this.currentSong.songId,
  865. data => {
  866. if (data.status !== "success")
  867. new Toast({
  868. content: `Error: ${data.message}`,
  869. timeout: 8000
  870. });
  871. }
  872. );
  873. },
  874. toggleDislike() {
  875. if (this.disliked)
  876. return this.socket.emit(
  877. "songs.undislike",
  878. this.currentSong.songId,
  879. data => {
  880. if (data.status !== "success")
  881. new Toast({
  882. content: `Error: ${data.message}`,
  883. timeout: 8000
  884. });
  885. }
  886. );
  887. return this.socket.emit(
  888. "songs.dislike",
  889. this.currentSong.songId,
  890. data => {
  891. if (data.status !== "success")
  892. new Toast({
  893. content: `Error: ${data.message}`,
  894. timeout: 8000
  895. });
  896. }
  897. );
  898. },
  899. addFirstPrivatePlaylistSongToQueue() {
  900. let isInQueue = false;
  901. if (this.station.type === "community") {
  902. this.songsList.forEach(queueSong => {
  903. if (queueSong.requestedBy === this.userId) isInQueue = true;
  904. });
  905. if (!isInQueue && this.privatePlaylistQueueSelected) {
  906. this.socket.emit(
  907. "playlists.getFirstSong",
  908. this.privatePlaylistQueueSelected,
  909. data => {
  910. if (data.status === "success") {
  911. if (data.song.duration < 15 * 60) {
  912. this.automaticallyRequestedSongId =
  913. data.song.songId;
  914. this.socket.emit(
  915. "stations.addToQueue",
  916. this.station._id,
  917. data.song.songId,
  918. data2 => {
  919. if (data2.status === "success") {
  920. this.socket.emit(
  921. "playlists.moveSongToBottom",
  922. this
  923. .privatePlaylistQueueSelected,
  924. data.song.songId,
  925. data3 => {
  926. if (
  927. data3.status ===
  928. "success"
  929. ) {} // eslint-disable-line
  930. }
  931. );
  932. }
  933. }
  934. );
  935. } else {
  936. new Toast({
  937. content: `Top song in playlist was too long to be added.`,
  938. timeout: 3000
  939. });
  940. this.socket.emit(
  941. "playlists.moveSongToBottom",
  942. this.privatePlaylistQueueSelected,
  943. data.song.songId,
  944. data3 => {
  945. if (data3.status === "success") {
  946. setTimeout(() => {
  947. this.addFirstPrivatePlaylistSongToQueue();
  948. }, 3000);
  949. }
  950. }
  951. );
  952. }
  953. }
  954. }
  955. );
  956. }
  957. }
  958. },
  959. join() {
  960. this.socket.emit("stations.join", this.stationName, res => {
  961. if (res.status === "success") {
  962. this.loading = false;
  963. const {
  964. _id,
  965. displayName,
  966. description,
  967. privacy,
  968. locked,
  969. partyMode,
  970. owner,
  971. privatePlaylist,
  972. type
  973. } = res.data;
  974. this.joinStation({
  975. _id,
  976. name: this.stationName,
  977. displayName,
  978. description,
  979. privacy,
  980. locked,
  981. partyMode,
  982. owner,
  983. privatePlaylist,
  984. type
  985. });
  986. const currentSong = res.data.currentSong
  987. ? res.data.currentSong
  988. : {};
  989. if (currentSong.artists)
  990. currentSong.artists = currentSong.artists.join(", ");
  991. this.updateCurrentSong(currentSong);
  992. this.startedAt = res.data.startedAt;
  993. this.updatePaused(res.data.paused);
  994. this.timePaused = res.data.timePaused;
  995. this.updateUserCount(res.data.userCount);
  996. this.updateUsers(res.data.users);
  997. this.pausedAt = res.data.pausedAt;
  998. if (res.data.currentSong) {
  999. this.updateNoSong(false);
  1000. this.youtubeReady();
  1001. this.playVideo();
  1002. this.socket.emit(
  1003. "songs.getOwnSongRatings",
  1004. res.data.currentSong.songId,
  1005. data => {
  1006. if (this.currentSong.songId === data.songId) {
  1007. this.liked = data.liked;
  1008. this.disliked = data.disliked;
  1009. }
  1010. }
  1011. );
  1012. } else {
  1013. if (this.playerReady) this.player.pauseVideo();
  1014. this.updateNoSong(true);
  1015. }
  1016. if (type === "community" && partyMode === true) {
  1017. this.socket.emit("stations.getQueue", _id, res => {
  1018. if (res.status === "success") {
  1019. this.updateSongsList(res.queue);
  1020. }
  1021. });
  1022. }
  1023. // UNIX client time before ping
  1024. const beforePing = Date.now();
  1025. this.socket.emit("apis.ping", pong => {
  1026. // UNIX client time after ping
  1027. const afterPing = Date.now();
  1028. // Average time in MS it took between the server responding and the client receiving
  1029. const connectionLatency = (afterPing - beforePing) / 2;
  1030. console.log(connectionLatency, beforePing - afterPing);
  1031. // UNIX server time
  1032. const serverDate = pong.date;
  1033. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  1034. const difference =
  1035. serverDate + connectionLatency - afterPing;
  1036. console.log("Difference: ", difference);
  1037. if (difference > 3000 || difference < -3000) {
  1038. console.log(
  1039. "System time difference is bigger than 3 seconds."
  1040. );
  1041. }
  1042. this.systemDifference = difference;
  1043. });
  1044. } else {
  1045. this.loading = false;
  1046. this.exists = false;
  1047. }
  1048. });
  1049. },
  1050. ...mapActions("modals", ["openModal"]),
  1051. ...mapActions("station", [
  1052. "joinStation",
  1053. "updateUserCount",
  1054. "updateUsers",
  1055. "updateCurrentSong",
  1056. "updatePreviousSong",
  1057. "updateSongsList",
  1058. "updatePaused",
  1059. "updateNoSong"
  1060. ])
  1061. },
  1062. mounted() {
  1063. Date.currently = () => {
  1064. return new Date().getTime() + this.systemDifference;
  1065. };
  1066. this.stationName = this.$route.params.id;
  1067. window.stationInterval = 0;
  1068. io.getSocket(socket => {
  1069. this.socket = socket;
  1070. io.removeAllListeners();
  1071. if (this.socket.connected) this.join();
  1072. io.onConnect(this.join);
  1073. this.socket.emit("stations.existsByName", this.stationName, res => {
  1074. if (res.status === "failure" || !res.exists) {
  1075. this.loading = false;
  1076. this.exists = false;
  1077. }
  1078. });
  1079. this.socket.on("event:songs.next", data => {
  1080. const previousSong = this.currentSong.songId
  1081. ? this.currentSong
  1082. : null;
  1083. this.updatePreviousSong(previousSong);
  1084. this.updateCurrentSong(
  1085. data.currentSong ? data.currentSong : {}
  1086. );
  1087. this.startedAt = data.startedAt;
  1088. this.updatePaused(data.paused);
  1089. this.timePaused = data.timePaused;
  1090. if (data.currentSong) {
  1091. this.updateNoSong(false);
  1092. if (this.currentSong.artists)
  1093. this.currentSong.artists = this.currentSong.artists.join(
  1094. ", "
  1095. );
  1096. if (!this.playerReady) this.youtubeReady();
  1097. else this.playVideo();
  1098. this.socket.emit(
  1099. "songs.getOwnSongRatings",
  1100. data.currentSong.songId,
  1101. song => {
  1102. if (this.currentSong.songId === song.songId) {
  1103. this.liked = song.liked;
  1104. this.disliked = song.disliked;
  1105. }
  1106. }
  1107. );
  1108. } else {
  1109. if (this.playerReady) this.player.pauseVideo();
  1110. this.updateNoSong(true);
  1111. }
  1112. let isInQueue = false;
  1113. this.songsList.forEach(queueSong => {
  1114. if (queueSong.requestedBy === this.userId) isInQueue = true;
  1115. });
  1116. if (
  1117. !isInQueue &&
  1118. this.privatePlaylistQueueSelected &&
  1119. (this.automaticallyRequestedSongId !==
  1120. this.currentSong.songId ||
  1121. !this.currentSong.songId)
  1122. ) {
  1123. this.addFirstPrivatePlaylistSongToQueue();
  1124. }
  1125. });
  1126. this.socket.on("event:stations.pause", data => {
  1127. this.pausedAt = data.pausedAt;
  1128. this.pauseLocalStation();
  1129. });
  1130. this.socket.on("event:stations.resume", data => {
  1131. this.timePaused = data.timePaused;
  1132. this.resumeLocalStation();
  1133. });
  1134. this.socket.on("event:stations.remove", () => {
  1135. window.location.href = "/";
  1136. return true;
  1137. });
  1138. this.socket.on("event:song.like", 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.dislike", 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.unlike", 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.undislike", data => {
  1163. if (!this.noSong) {
  1164. if (data.songId === this.currentSong.songId) {
  1165. this.currentSong.dislikes = data.dislikes;
  1166. this.currentSong.likes = data.likes;
  1167. }
  1168. }
  1169. });
  1170. this.socket.on("event:song.newRatings", data => {
  1171. if (!this.noSong) {
  1172. if (data.songId === this.currentSong.songId) {
  1173. this.liked = data.liked;
  1174. this.disliked = data.disliked;
  1175. }
  1176. }
  1177. });
  1178. this.socket.on("event:queue.update", queue => {
  1179. if (this.station.type === "community")
  1180. this.updateSongsList(queue);
  1181. });
  1182. this.socket.on("event:song.voteSkipSong", () => {
  1183. if (this.currentSong) this.currentSong.skipVotes += 1;
  1184. });
  1185. this.socket.on("event:privatePlaylist.selected", playlistId => {
  1186. if (this.station.type === "community") {
  1187. this.station.privatePlaylist = playlistId;
  1188. }
  1189. });
  1190. this.socket.on("event:partyMode.updated", partyMode => {
  1191. if (this.station.type === "community") {
  1192. this.station.partyMode = partyMode;
  1193. }
  1194. });
  1195. this.socket.on("event:newOfficialPlaylist", playlist => {
  1196. if (this.station.type === "official") {
  1197. this.updateSongsList(playlist);
  1198. }
  1199. });
  1200. this.socket.on("event:users.updated", users => {
  1201. this.updateUsers(users);
  1202. });
  1203. this.socket.on("event:userCount.updated", userCount => {
  1204. this.updateUserCount(userCount);
  1205. });
  1206. this.socket.on("event:queueLockToggled", locked => {
  1207. this.station.locked = locked;
  1208. });
  1209. });
  1210. if (JSON.parse(localStorage.getItem("muted"))) {
  1211. this.muted = true;
  1212. this.player.setVolume(0);
  1213. document.getElementById("volumeSlider").value = 0 * 100;
  1214. } else {
  1215. let volume = parseFloat(localStorage.getItem("volume"));
  1216. volume =
  1217. typeof volume === "number" && !Number.isNaN(volume)
  1218. ? volume
  1219. : 20;
  1220. localStorage.setItem("volume", volume);
  1221. document.getElementById("volumeSlider").value = volume * 100;
  1222. }
  1223. },
  1224. components: {
  1225. StationHeader,
  1226. SongQueue: () => import("../Modals/AddSongToQueue.vue"),
  1227. AddToPlaylist: () => import("../Modals/AddSongToPlaylist.vue"),
  1228. EditPlaylist: () => import("../Modals/Playlists/Edit.vue"),
  1229. CreatePlaylist: () => import("../Modals/Playlists/Create.vue"),
  1230. EditStation: () => import("../Modals/EditStation.vue"),
  1231. Report: () => import("../Modals/Report.vue"),
  1232. SongsListSidebar: () => import("../Sidebars/SongsList.vue"),
  1233. PlaylistSidebar: () => import("../Sidebars/Playlist.vue"),
  1234. UsersSidebar: () => import("../Sidebars/UsersList.vue"),
  1235. UserIdToUsername,
  1236. Z404
  1237. }
  1238. };
  1239. </script>
  1240. <style lang="scss">
  1241. @import "styles/global.scss";
  1242. .night-mode {
  1243. .nav,
  1244. .control-sidebar {
  1245. background-color: #222;
  1246. }
  1247. }
  1248. .player-can-not-autoplay {
  1249. position: absolute;
  1250. width: 100%;
  1251. height: 100%;
  1252. background: rgba(3, 169, 244, 0.95);
  1253. display: flex;
  1254. align-items: center;
  1255. justify-content: center;
  1256. p {
  1257. color: $white;
  1258. font-size: 26px;
  1259. text-align: center;
  1260. }
  1261. }
  1262. .slide-enter-active,
  1263. .slide-leave-active {
  1264. transition: all 0.3s ease;
  1265. }
  1266. .slide-enter,
  1267. .slide-leave-to {
  1268. transform: translateX(300px);
  1269. }
  1270. .no-song {
  1271. color: $primary-color;
  1272. text-align: center;
  1273. }
  1274. #volumeSlider {
  1275. padding: 0 15px;
  1276. background: transparent;
  1277. }
  1278. .volume-slider-wrapper {
  1279. margin-top: 0;
  1280. position: relative;
  1281. display: flex;
  1282. align-items: center;
  1283. .material-icons {
  1284. user-select: none;
  1285. }
  1286. }
  1287. .material-icons {
  1288. cursor: pointer;
  1289. }
  1290. .stationDisplayName {
  1291. color: $white !important;
  1292. }
  1293. .add-to-playlist {
  1294. display: flex;
  1295. align-items: center;
  1296. justify-content: center;
  1297. }
  1298. .slideout {
  1299. top: 50px;
  1300. height: 100%;
  1301. position: fixed;
  1302. right: 0;
  1303. width: 350px;
  1304. background-color: $white;
  1305. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  1306. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  1307. .slideout-header {
  1308. text-align: center;
  1309. background-color: rgb(3, 169, 244) !important;
  1310. margin: 0;
  1311. padding-top: 5px;
  1312. padding-bottom: 7px;
  1313. color: $white;
  1314. }
  1315. .slideout-content {
  1316. height: 100%;
  1317. }
  1318. }
  1319. .modal-large {
  1320. width: 75%;
  1321. }
  1322. .station {
  1323. flex: 1 0 auto;
  1324. padding-top: 0.5vw;
  1325. transition: all 0.1s;
  1326. margin: 0 auto;
  1327. max-width: 100%;
  1328. width: 90%;
  1329. @media only screen and (min-width: 993px) {
  1330. width: 70%;
  1331. }
  1332. @media only screen and (min-width: 601px) {
  1333. width: 85%;
  1334. }
  1335. @media (min-width: 999px) {
  1336. .mobile-only {
  1337. display: none;
  1338. }
  1339. .desktop-only {
  1340. display: block;
  1341. }
  1342. }
  1343. @media (max-width: 998px) {
  1344. .mobile-only {
  1345. display: block;
  1346. }
  1347. .desktop-only {
  1348. display: none;
  1349. visibility: hidden;
  1350. }
  1351. }
  1352. .mobile-only {
  1353. text-align: center;
  1354. }
  1355. .playlistCard {
  1356. margin: 10px;
  1357. position: relative;
  1358. padding-bottom: calc(31.25% + 7px);
  1359. height: 0;
  1360. overflow-y: scroll;
  1361. .title {
  1362. background-color: rgb(3, 169, 244);
  1363. text-align: center;
  1364. padding: 10px;
  1365. color: $white;
  1366. font-weight: 600;
  1367. }
  1368. .media {
  1369. padding: 0 25px;
  1370. }
  1371. .media-content .content {
  1372. min-height: 64px;
  1373. max-height: 64px;
  1374. display: flex;
  1375. align-items: center;
  1376. }
  1377. .content p strong {
  1378. word-break: break-word;
  1379. }
  1380. .content p small {
  1381. word-break: break-word;
  1382. }
  1383. .add-to-queue {
  1384. width: 100%;
  1385. margin-top: 25px;
  1386. height: 40px;
  1387. border-radius: 0;
  1388. background: rgb(3, 169, 244);
  1389. color: $white !important;
  1390. border: 0;
  1391. &:active,
  1392. &:focus {
  1393. border: 0;
  1394. }
  1395. }
  1396. .add-to-queue:focus {
  1397. background: $primary-color;
  1398. }
  1399. .media-right {
  1400. line-height: 64px;
  1401. }
  1402. .songTitle {
  1403. word-wrap: break-word;
  1404. overflow: hidden;
  1405. text-overflow: ellipsis;
  1406. display: -webkit-box;
  1407. -webkit-box-orient: vertical;
  1408. -webkit-line-clamp: 2;
  1409. line-height: 20px;
  1410. max-height: 40px;
  1411. width: 100%;
  1412. }
  1413. }
  1414. input[type="range"] {
  1415. -webkit-appearance: none;
  1416. width: 100%;
  1417. margin: 7.3px 0;
  1418. }
  1419. input[type="range"]:focus {
  1420. outline: none;
  1421. }
  1422. input[type="range"]::-webkit-slider-runnable-track {
  1423. width: 100%;
  1424. height: 5.2px;
  1425. cursor: pointer;
  1426. box-shadow: 0;
  1427. background: $light-grey-2;
  1428. border-radius: 0;
  1429. border: 0;
  1430. }
  1431. input[type="range"]::-webkit-slider-thumb {
  1432. box-shadow: 0;
  1433. border: 0;
  1434. height: 19px;
  1435. width: 19px;
  1436. border-radius: 15px;
  1437. background: $primary-color;
  1438. cursor: pointer;
  1439. -webkit-appearance: none;
  1440. margin-top: -6.5px;
  1441. }
  1442. input[type="range"]::-moz-range-track {
  1443. width: 100%;
  1444. height: 5.2px;
  1445. cursor: pointer;
  1446. box-shadow: 0;
  1447. background: $light-grey-2;
  1448. border-radius: 0;
  1449. border: 0;
  1450. }
  1451. input[type="range"]::-moz-range-thumb {
  1452. box-shadow: 0;
  1453. border: 0;
  1454. height: 19px;
  1455. width: 19px;
  1456. border-radius: 15px;
  1457. background: $primary-color;
  1458. cursor: pointer;
  1459. -webkit-appearance: none;
  1460. margin-top: -6.5px;
  1461. }
  1462. input[type="range"]::-ms-track {
  1463. width: 100%;
  1464. height: 5.2px;
  1465. cursor: pointer;
  1466. box-shadow: 0;
  1467. background: $light-grey-2;
  1468. border-radius: 1.3px;
  1469. }
  1470. input[type="range"]::-ms-fill-lower {
  1471. background: $light-grey-2;
  1472. border: 0;
  1473. border-radius: 0;
  1474. box-shadow: 0;
  1475. }
  1476. input[type="range"]::-ms-fill-upper {
  1477. background: $light-grey-2;
  1478. border: 0;
  1479. border-radius: 0;
  1480. box-shadow: 0;
  1481. }
  1482. input[type="range"]::-ms-thumb {
  1483. box-shadow: 0;
  1484. border: 0;
  1485. height: 15px;
  1486. width: 15px;
  1487. border-radius: 15px;
  1488. background: $primary-color;
  1489. cursor: pointer;
  1490. -webkit-appearance: none;
  1491. margin-top: 1.5px;
  1492. }
  1493. .video-container {
  1494. position: relative;
  1495. padding-bottom: 56.25%;
  1496. height: 0;
  1497. overflow: hidden;
  1498. iframe {
  1499. position: absolute;
  1500. top: 0;
  1501. left: 0;
  1502. width: 100%;
  1503. height: 100%;
  1504. }
  1505. }
  1506. .video-col {
  1507. padding-right: 0.75rem;
  1508. padding-left: 0.75rem;
  1509. }
  1510. }
  1511. .room-title {
  1512. left: 50%;
  1513. -webkit-transform: translateX(-50%);
  1514. transform: translateX(-50%);
  1515. font-size: 2.1em;
  1516. }
  1517. #ratings {
  1518. span {
  1519. font-size: 1.68rem;
  1520. }
  1521. i {
  1522. color: #9e9e9e !important;
  1523. cursor: pointer;
  1524. transition: 0.1s color;
  1525. }
  1526. }
  1527. #time-display {
  1528. margin-top: 30px;
  1529. float: right;
  1530. }
  1531. #thumbs_up:hover,
  1532. #thumbs_up.liked {
  1533. color: $green !important;
  1534. }
  1535. #thumbs_down:hover,
  1536. #thumbs_down.disliked {
  1537. color: $red !important;
  1538. }
  1539. #song-thumbnail {
  1540. max-width: 100%;
  1541. width: 85%;
  1542. }
  1543. .seeker-bar-container {
  1544. position: relative;
  1545. height: 7px;
  1546. display: block;
  1547. width: 100%;
  1548. overflow: hidden;
  1549. }
  1550. .seeker-bar {
  1551. top: 0;
  1552. left: 0;
  1553. bottom: 0;
  1554. position: absolute;
  1555. }
  1556. ul {
  1557. list-style: none;
  1558. margin: 0;
  1559. display: block;
  1560. }
  1561. h1,
  1562. h2,
  1563. h3,
  1564. h4,
  1565. h5,
  1566. h6 {
  1567. font-weight: 400;
  1568. line-height: 1.1;
  1569. }
  1570. h1 a,
  1571. h2 a,
  1572. h3 a,
  1573. h4 a,
  1574. h5 a,
  1575. h6 a {
  1576. font-weight: inherit;
  1577. }
  1578. h1 {
  1579. font-size: 4.2rem;
  1580. line-height: 110%;
  1581. margin: 2.1rem 0 1.68rem 0;
  1582. }
  1583. h2 {
  1584. font-size: 3.56rem;
  1585. line-height: 110%;
  1586. margin: 1.78rem 0 1.424rem 0;
  1587. }
  1588. h3 {
  1589. font-size: 2.92rem;
  1590. line-height: 110%;
  1591. margin: 1.46rem 0 1.168rem 0;
  1592. }
  1593. h4 {
  1594. font-size: 2.28rem;
  1595. line-height: 110%;
  1596. margin: 1.14rem 0 0.912rem 0;
  1597. }
  1598. h5 {
  1599. font-size: 1.64rem;
  1600. line-height: 110%;
  1601. margin: 0.82rem 0 0.656rem 0;
  1602. }
  1603. h6 {
  1604. font-size: 1rem;
  1605. line-height: 110%;
  1606. margin: 0.5rem 0 0.4rem 0;
  1607. }
  1608. .thin {
  1609. font-weight: 200;
  1610. }
  1611. .left {
  1612. float: left !important;
  1613. }
  1614. .right {
  1615. float: right !important;
  1616. }
  1617. .light-blue {
  1618. background-color: $primary-color !important;
  1619. }
  1620. .white {
  1621. background-color: $white !important;
  1622. }
  1623. .btn-search {
  1624. font-size: 14px;
  1625. }
  1626. .menu {
  1627. padding: 0 10px;
  1628. }
  1629. .menu-list li a:hover {
  1630. color: #000 !important;
  1631. }
  1632. .menu-list li {
  1633. display: flex;
  1634. justify-content: space-between;
  1635. }
  1636. .menu-list a {
  1637. /*padding: 0 10px !important;*/
  1638. }
  1639. .menu-list a:hover {
  1640. background-color: transparent;
  1641. }
  1642. .icons-group {
  1643. display: flex;
  1644. }
  1645. #like,
  1646. #dislike {
  1647. position: relative;
  1648. }
  1649. .behind {
  1650. z-index: -1;
  1651. }
  1652. .behind:focus {
  1653. z-index: 0;
  1654. }
  1655. .progress {
  1656. width: 50px;
  1657. animation: rotate 0.8s infinite linear;
  1658. border: 8px solid $primary-color;
  1659. border-right-color: transparent;
  1660. height: 50px;
  1661. position: absolute;
  1662. top: 50%;
  1663. left: 50%;
  1664. }
  1665. @keyframes rotate {
  1666. 0% {
  1667. transform: rotate(0deg);
  1668. }
  1669. 100% {
  1670. transform: rotate(360deg);
  1671. }
  1672. }
  1673. .experimental {
  1674. display: none !important;
  1675. }
  1676. </style>