Station.vue 41 KB

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