Station.vue 41 KB

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