Station.vue 41 KB

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