Station.vue 44 KB

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