Station.vue 39 KB

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