index.vue 43 KB

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