index.vue 42 KB

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