Station.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <official-header v-if='type == "official"'></official-header>
  3. <community-header v-if='type == "community"'></community-header>
  4. <song-queue v-if='modals.addSongToQueue'></song-queue>
  5. <edit-playlist v-if='modals.editPlaylist'></edit-playlist>
  6. <create-playlist v-if='modals.createPlaylist'></create-playlist>
  7. <edit-station v-show='modals.editStation'></edit-station>
  8. <report v-if='modals.report'></report>
  9. <songs-list-sidebar v-if='sidebars.songslist'></songs-list-sidebar>
  10. <playlist-sidebar v-if='sidebars.playlist'></playlist-sidebar>
  11. <users-sidebar v-if='sidebars.users'></users-sidebar>
  12. <div class="station">
  13. <div v-show="noSong" class="no-song">
  14. <h1>No song is currently playing</h1>
  15. <h4 v-if='type === "community" && station.partyMode'>
  16. <a href='#' class='no-song' @click='modals.addSongToQueue = true'>Add a Song to the Queue</a>
  17. </h4>
  18. <h4 v-if='type === "community" && !station.partyMode && $parent.userId === station.owner && !station.privatePlaylist'>
  19. <a href='#' class='no-song' @click='sidebars.playlist = true'>Play a private playlist</a>
  20. </h4>
  21. <h1 v-if='type === "community" && !station.partyMode && $parent.userId === station.owner && station.privatePlaylist'>Maybe you can add some songs to your selected private playlist and then press the skip button</h1>
  22. </div>
  23. <div class="columns is-mobile" v-show="!noSong">
  24. <div class="column is-8-desktop is-offset-2-desktop is-12-mobile">
  25. <div class="video-container">
  26. <div id="player"></div>
  27. <div class="seeker-bar-container white" id="preview-progress">
  28. <div class="seeker-bar light-blue" style="width: 0%;"></div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="columns is-mobile" v-show="!noSong">
  34. <div class="column is-8-desktop is-offset-2-desktop is-12-mobile">
  35. <div class="columns is-mobile">
  36. <div class="column is-12-mobile" v-bind:class="{'is-8-desktop': !simpleSong}">
  37. <h4 id="time-display">{{timeElapsed}} / {{formatTime(currentSong.duration)}}</h4>
  38. <h3>{{currentSong.title}}</h3>
  39. <h4 class="thin" style="margin-left: 0">{{currentSong.artists}}</h4>
  40. <div class="columns is-mobile">
  41. <form style="margin-top: 12px; margin-bottom: 0;" action="#" class="column is-7-desktop is-4-mobile">
  42. <p class='volume-slider-wrapper'>
  43. <i class="material-icons" @click='toggleMute()' v-if='muted'>volume_mute</i>
  44. <i class="material-icons" @click='toggleMute()' v-else>volume_down</i>
  45. <input type="range" id="volumeSlider" min="0" max="100" class="active" v-on:change="changeVolume()" v-on:input="changeVolume()">
  46. <i class="material-icons" @click='toggleMaxVolume()'>volume_up</i>
  47. </p>
  48. </form>
  49. <div class="column is-8-mobile is-5-desktop" style="float: right;">
  50. <ul id="ratings" v-if="currentSong.likes !== -1 && currentSong.dislikes !== -1">
  51. <li id="like" class="right" @click="toggleLike()">
  52. <span class="flow-text">{{currentSong.likes}} </span>
  53. <i id="thumbs_up" class="material-icons grey-text" v-bind:class="{ liked: liked }">thumb_up</i>
  54. <a class='absolute-a behind' @click="toggleLike()" href='#'></a>
  55. </li>
  56. <li style="margin-right: 10px;" id="dislike" class="right" @click="toggleDislike()">
  57. <span class="flow-text">{{currentSong.dislikes}} </span>
  58. <i id="thumbs_down" class="material-icons grey-text" v-bind:class="{ disliked: disliked }">thumb_down</i>
  59. <a class='absolute-a behind' @click="toggleDislike()" href='#'></a>
  60. </li>
  61. </ul>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="column is-4-desktop" v-if="!simpleSong">
  66. <img class="image" id="song-thumbnail" style="margin-top: 10px !important" :src="currentSong.thumbnail" alt="Song Thumbnail" onerror="this.src='/assets/notes-transparent.png'" />
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </template>
  73. <script>
  74. import { Toast } from 'vue-roaster';
  75. import SongQueue from '../Modals/AddSongToQueue.vue';
  76. import EditPlaylist from '../Modals/Playlists/Edit.vue';
  77. import CreatePlaylist from '../Modals/Playlists/Create.vue';
  78. import EditStation from '../Modals/EditStation.vue';
  79. import Report from '../Modals/Report.vue';
  80. import SongsListSidebar from '../Sidebars/SongsList.vue';
  81. import PlaylistSidebar from '../Sidebars/Playlist.vue';
  82. import UsersSidebar from '../Sidebars/UsersList.vue';
  83. import OfficialHeader from './OfficialHeader.vue';
  84. import CommunityHeader from './CommunityHeader.vue';
  85. import io from '../../io';
  86. import auth from '../../auth';
  87. export default {
  88. data() {
  89. return {
  90. type: '',
  91. playerReady: false,
  92. previousSong: null,
  93. currentSong: {},
  94. player: undefined,
  95. timePaused: 0,
  96. paused: false,
  97. muted: false,
  98. timeElapsed: '0:00',
  99. liked: false,
  100. disliked: false,
  101. modals: {
  102. addSongToQueue: false,
  103. editPlaylist: false,
  104. createPlaylist: false,
  105. editStation: false,
  106. report: false
  107. },
  108. sidebars: {
  109. songslist: false,
  110. users: false,
  111. playlist: false
  112. },
  113. noSong: false,
  114. simpleSong: false,
  115. songsList: [],
  116. timeBeforePause: 0,
  117. station: {},
  118. skipVotes: 0,
  119. privatePlaylistQueueSelected: null,
  120. automaticallyRequestedSongId: null,
  121. systemDifference: 0
  122. }
  123. },
  124. methods: {
  125. editPlaylist: function (id) {
  126. this.playlistBeingEdited = id;
  127. this.modals.editPlaylist = !this.modals.editPlaylist;
  128. },
  129. editStation: function () {
  130. let _this = this;
  131. this.$broadcast('editStation', {
  132. _id: _this.$route.params.id,
  133. type: _this.type,
  134. partyMode: _this.station.partyMode,
  135. description: _this.station.description,
  136. privacy: _this.station.privacy,
  137. displayName: _this.station.displayName
  138. });
  139. //this.modals.editStation = !this.modals.editStation;
  140. },
  141. toggleSidebar: function (type) {
  142. Object.keys(this.sidebars).forEach(sidebar => {
  143. if (sidebar !== type) this.sidebars[sidebar] = false;
  144. else this.sidebars[type] = !this.sidebars[type];
  145. });
  146. },
  147. youtubeReady: function() {
  148. let local = this;
  149. if (!local.player) {
  150. local.player = new YT.Player("player", {
  151. height: 270,
  152. width: 480,
  153. videoId: local.currentSong._id,
  154. startSeconds: local.getTimeElapsed() / 1000 + local.currentSong.skipDuration,
  155. playerVars: {controls: 0, iv_load_policy: 3, rel: 0, showinfo: 0},
  156. events: {
  157. 'onReady': function (event) {
  158. local.playerReady = true;
  159. let volume = parseInt(localStorage.getItem("volume"));
  160. volume = (typeof volume === "number") ? volume : 20;
  161. local.player.setVolume(volume);
  162. if (volume > 0) local.player.unMute();
  163. local.playVideo();
  164. },
  165. 'onError': function(err) {
  166. console.log("iframe error", err);
  167. local.voteSkipStation();
  168. },
  169. 'onStateChange': function (event) {
  170. if (event.data === 1 && local.videoLoading === true) {
  171. local.videoLoading = false;
  172. local.player.seekTo(local.getTimeElapsed() / 1000 + local.currentSong.skipDuration, true);
  173. if (local.paused) local.player.pauseVideo();
  174. } else if (event.data === 1 && local.paused) {
  175. local.player.seekTo(local.timeBeforePause / 1000, true);
  176. local.player.pauseVideo();
  177. }
  178. if (event.data === 2 && !local.paused && !local.noSong && (local.player.getDuration() / 1000) < local.currentSong.duration) {
  179. local.player.seekTo(local.getTimeElapsed() / 1000 + local.currentSong.skipDuration, true);
  180. local.player.playVideo();
  181. }
  182. }
  183. }
  184. });
  185. }
  186. },
  187. getTimeElapsed: function() {
  188. let local = this;
  189. if (local.currentSong) return Date.currently() - local.startedAt - local.timePaused;
  190. else return 0;
  191. },
  192. playVideo: function() {
  193. let local = this;
  194. if (local.playerReady) {
  195. local.videoLoading = true;
  196. local.player.loadVideoById(local.currentSong._id, local.getTimeElapsed() / 1000 + local.currentSong.skipDuration);
  197. if (local.currentSong.artists) local.currentSong.artists = local.currentSong.artists.join(", ");
  198. if (window.stationInterval !== 0) clearInterval(window.stationInterval);
  199. window.stationInterval = setInterval(function () {
  200. local.resizeSeekerbar();
  201. local.calculateTimeElapsed();
  202. }, 250);
  203. }
  204. },
  205. resizeSeekerbar: function() {
  206. let local = this;
  207. if (!local.paused) {
  208. $(".seeker-bar").width(parseInt(((local.getTimeElapsed() / 1000) / local.currentSong.duration * 100)) + "%");
  209. }
  210. },
  211. formatTime: function(duration) {
  212. let d = moment.duration(duration, 'seconds');
  213. if (duration < 0) return "0:00";
  214. return ((d.hours() > 0) ? (d.hours() < 10 ? ("0" + d.hours() + ":") : (d.hours() + ":")) : "") + (d.minutes() + ":") + (d.seconds() < 10 ? ("0" + d.seconds()) : d.seconds());
  215. },
  216. calculateTimeElapsed: function() {
  217. let local = this;
  218. let currentTime = Date.currently();
  219. if (local.currentTime !== undefined && local.paused) {
  220. local.timePaused += (Date.currently() - local.currentTime);
  221. local.currentTime = undefined;
  222. }
  223. let duration = (Date.currently() - local.startedAt - local.timePaused) / 1000;
  224. let songDuration = local.currentSong.duration;
  225. if (songDuration <= duration) local.player.pauseVideo();
  226. if ((!local.paused) && duration <= songDuration) local.timeElapsed = local.formatTime(duration);
  227. },
  228. changeVolume: function() {
  229. let local = this;
  230. let volume = $("#volumeSlider").val();
  231. localStorage.setItem("volume", volume);
  232. if (local.playerReady) {
  233. local.player.setVolume(volume);
  234. if (volume > 0) local.player.unMute();
  235. }
  236. },
  237. resumeLocalStation: function() {
  238. this.paused = false;
  239. if (!this.noSong) {
  240. if (this.playerReady) {
  241. this.player.seekTo(this.getTimeElapsed() / 1000 + this.currentSong.skipDuration);
  242. this.player.playVideo();
  243. }
  244. }
  245. },
  246. pauseLocalStation: function() {
  247. this.paused = true;
  248. if (!this.noSong) {
  249. this.timeBeforePause = this.getTimeElapsed();
  250. if (this.playerReady) this.player.pauseVideo();
  251. }
  252. },
  253. skipStation: function () {
  254. let _this = this;
  255. _this.socket.emit('stations.forceSkip', _this.stationId, data => {
  256. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  257. else Toast.methods.addToast('Successfully skipped the station\'s current song.', 4000);
  258. });
  259. },
  260. voteSkipStation: function () {
  261. let _this = this;
  262. _this.socket.emit('stations.voteSkip', _this.stationId, data => {
  263. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  264. else Toast.methods.addToast('Successfully voted to skip the current song.', 4000);
  265. });
  266. },
  267. resumeStation: function () {
  268. let _this = this;
  269. _this.socket.emit('stations.resume', _this.stationId, data => {
  270. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  271. else Toast.methods.addToast('Successfully resumed the station.', 4000);
  272. });
  273. },
  274. pauseStation: function () {
  275. let _this = this;
  276. _this.socket.emit('stations.pause', _this.stationId, data => {
  277. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  278. else Toast.methods.addToast('Successfully paused the station.', 4000);
  279. });
  280. },
  281. toggleMute: function () {
  282. if (this.playerReady) {
  283. let previousVolume = parseInt(localStorage.getItem("volume"));
  284. let volume = this.player.getVolume() <= 0 ? previousVolume : 0;
  285. this.muted = !this.muted;
  286. $("#volumeSlider").val(volume);
  287. this.player.setVolume(volume);
  288. }
  289. },
  290. toggleMaxVolume: function () {
  291. if (this.playerReady) {
  292. let previousVolume = parseInt(localStorage.getItem("volume"));
  293. let volume = this.player.getVolume() <= previousVolume ? 100 : previousVolume;
  294. $("#volumeSlider").val(volume);
  295. this.player.setVolume(volume);
  296. }
  297. },
  298. toggleLike: function() {
  299. let _this = this;
  300. if (_this.liked) _this.socket.emit('songs.unlike', _this.currentSong._id, data => {
  301. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  302. }); else _this.socket.emit('songs.like', _this.currentSong._id, data => {
  303. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  304. });
  305. },
  306. toggleDislike: function() {
  307. let _this = this;
  308. if (_this.disliked) return _this.socket.emit('songs.undislike', _this.currentSong._id, data => {
  309. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  310. });
  311. _this.socket.emit('songs.dislike', _this.currentSong._id, data => {
  312. if (data.status !== 'success') Toast.methods.addToast(`Error: ${data.message}`, 8000);
  313. });
  314. },
  315. addFirstPrivatePlaylistSongToQueue: function() {
  316. let _this = this;
  317. let isInQueue = false;
  318. let userId = _this.$parent.userId;
  319. if (_this.type === 'community') {
  320. _this.songsList.forEach((queueSong) => {
  321. if (queueSong.requestedBy === userId) isInQueue = true;
  322. });
  323. if (!isInQueue && _this.privatePlaylistQueueSelected) {
  324. _this.socket.emit('playlists.getFirstSong', _this.privatePlaylistQueueSelected, data => {
  325. if (data.status === 'success') {
  326. let songId = data.song._id;
  327. _this.automaticallyRequestedSongId = songId;
  328. _this.socket.emit('stations.addToQueue', _this.stationId, songId, data => {
  329. if (data.status === 'success') {
  330. _this.socket.emit('playlists.moveSongToBottom', _this.privatePlaylistQueueSelected, songId, data => {
  331. if (data.status === 'success') {}
  332. });
  333. }
  334. });
  335. }
  336. });
  337. }
  338. }
  339. },
  340. joinStation: function () {
  341. let _this = this;
  342. _this.socket.emit('stations.join', _this.stationId, res => {
  343. if (res.status === 'success') {
  344. _this.station = {
  345. _id: _this.stationId,
  346. displayName: res.data.displayName,
  347. description: res.data.description,
  348. privacy: res.data.privacy,
  349. partyMode: res.data.partyMode,
  350. owner: res.data.owner,
  351. privatePlaylist: res.data.privatePlaylist
  352. };
  353. _this.currentSong = (res.data.currentSong) ? res.data.currentSong : {};
  354. _this.type = res.data.type;
  355. _this.startedAt = res.data.startedAt;
  356. _this.paused = res.data.paused;
  357. _this.timePaused = res.data.timePaused;
  358. if (res.data.currentSong) {
  359. _this.noSong = false;
  360. _this.simpleSong = (res.data.currentSong.likes === -1 && res.data.currentSong.dislikes === -1);
  361. if (_this.simpleSong) {
  362. _this.currentSong.skipDuration = 0;
  363. }
  364. _this.youtubeReady();
  365. _this.playVideo();
  366. _this.socket.emit('songs.getOwnSongRatings', res.data.currentSong._id, data => {
  367. if (_this.currentSong._id === data.songId) {
  368. _this.liked = data.liked;
  369. _this.disliked = data.disliked;
  370. }
  371. });
  372. } else {
  373. if (_this.playerReady) _this.player.pauseVideo();
  374. _this.noSong = true;
  375. }
  376. if (_this.type === 'community') {
  377. _this.socket.emit('stations.getQueue', _this.stationId, data => {
  378. if (data.status === 'success') _this.songsList = data.queue;
  379. });
  380. }
  381. if (_this.type === 'official') {
  382. _this.socket.emit('stations.getPlaylist', _this.stationId, res => {
  383. if (res.status == 'success') _this.songsList = res.data;
  384. });
  385. }
  386. }
  387. // UNIX client time before ping
  388. let beforePing = Date.now();
  389. _this.socket.emit('apis.ping', res => {
  390. // UNIX client time after ping
  391. let afterPing = Date.now();
  392. // Average time in MS it took between the server responding and the client receiving
  393. let connectionLatency = (afterPing - beforePing) / 2;
  394. console.log(connectionLatency, beforePing - afterPing);
  395. // UNIX server time
  396. let serverDate = res.date;
  397. // Difference between the server UNIX time and the client UNIX time after ping, with the connectionLatency added to the server UNIX time
  398. let difference = (serverDate + connectionLatency) - afterPing;
  399. console.log("Difference: ", difference);
  400. if (difference > 3000 || difference < -3000) {
  401. console.log("System time difference is bigger than 3 seconds.");
  402. }
  403. _this.systemDifference = difference;
  404. });
  405. });
  406. }
  407. },
  408. ready: function() {
  409. let _this = this;
  410. Date.currently = () => {
  411. return new Date().getTime() + _this.systemDifference;
  412. };
  413. _this.stationId = _this.$route.params.id;
  414. window.stationInterval = 0;
  415. io.getSocket(socket => {
  416. _this.socket = socket;
  417. io.removeAllListeners();
  418. if (_this.socket.connected) _this.joinStation();
  419. io.onConnect(() => {
  420. _this.joinStation();
  421. });
  422. _this.socket.emit('stations.find', _this.stationId, res => {
  423. if (res.status === 'error') {
  424. _this.$router.go('/404');
  425. Toast.methods.addToast(res.message, 3000);
  426. }
  427. });
  428. _this.socket.on('event:songs.next', data => {
  429. _this.previousSong = (_this.currentSong._id) ? _this.currentSong : null;
  430. _this.currentSong = (data.currentSong) ? data.currentSong : {};
  431. _this.startedAt = data.startedAt;
  432. _this.paused = data.paused;
  433. _this.timePaused = data.timePaused;
  434. if (data.currentSong) {
  435. _this.noSong = false;
  436. _this.simpleSong = (data.currentSong.likes === -1 && data.currentSong.dislikes === -1);
  437. if (_this.simpleSong) _this.currentSong.skipDuration = 0;
  438. if (!_this.playerReady) _this.youtubeReady();
  439. else _this.playVideo();
  440. _this.socket.emit('songs.getOwnSongRatings', data.currentSong._id, (data) => {
  441. if (_this.currentSong._id === data.songId) {
  442. _this.liked = data.liked;
  443. _this.disliked = data.disliked;
  444. }
  445. });
  446. } else {
  447. if (_this.playerReady) _this.player.pauseVideo();
  448. _this.noSong = true;
  449. }
  450. let isInQueue = false;
  451. let userId = _this.$parent.userId;
  452. _this.songsList.forEach((queueSong) => {
  453. if (queueSong.requestedBy === userId) isInQueue = true;
  454. });
  455. if (!isInQueue && _this.privatePlaylistQueueSelected && (_this.automaticallyRequestedSongId !== _this.currentSong._id || !_this.currentSong._id)) {
  456. _this.addFirstPrivatePlaylistSongToQueue();
  457. }
  458. });
  459. _this.socket.on('event:stations.pause', data => {
  460. _this.pauseLocalStation();
  461. });
  462. _this.socket.on('event:stations.resume', data => {
  463. _this.timePaused = data.timePaused;
  464. _this.resumeLocalStation();
  465. });
  466. _this.socket.on('event:song.like', data => {
  467. if (!this.noSong) {
  468. if (data.songId === _this.currentSong._id) {
  469. _this.currentSong.dislikes = data.dislikes;
  470. _this.currentSong.likes = data.likes;
  471. }
  472. }
  473. });
  474. _this.socket.on('event:song.dislike', data => {
  475. if (!this.noSong) {
  476. if (data.songId === _this.currentSong._id) {
  477. _this.currentSong.dislikes = data.dislikes;
  478. _this.currentSong.likes = data.likes;
  479. }
  480. }
  481. });
  482. _this.socket.on('event:song.unlike', data => {
  483. if (!this.noSong) {
  484. if (data.songId === _this.currentSong._id) {
  485. _this.currentSong.dislikes = data.dislikes;
  486. _this.currentSong.likes = data.likes;
  487. }
  488. }
  489. });
  490. _this.socket.on('event:song.undislike', data => {
  491. if (!this.noSong) {
  492. if (data.songId === _this.currentSong._id) {
  493. _this.currentSong.dislikes = data.dislikes;
  494. _this.currentSong.likes = data.likes;
  495. }
  496. }
  497. });
  498. _this.socket.on('event:song.newRatings', data => {
  499. if (!this.noSong) {
  500. if (data.songId === _this.currentSong._id) {
  501. _this.liked = data.liked;
  502. _this.disliked = data.disliked;
  503. }
  504. }
  505. });
  506. _this.socket.on('event:queue.update', queue => {
  507. if (this.type === 'community') this.songsList = queue;
  508. });
  509. _this.socket.on('event:song.voteSkipSong', () => {
  510. if (this.currentSong) this.currentSong.skipVotes++;
  511. });
  512. _this.socket.on('event:privatePlaylist.selected', (playlistId) => {
  513. if (this.type === 'community') {
  514. this.station.privatePlaylist = playlistId;
  515. }
  516. });
  517. _this.socket.on('event:partyMode.updated', (partyMode) => {
  518. if (this.type === 'community') {
  519. this.station.partyMode = partyMode;
  520. }
  521. });
  522. _this.socket.on('event:newOfficialPlaylist', (playlist) => {
  523. console.log(playlist);
  524. if (this.type === 'official') {
  525. this.songsList = playlist;
  526. }
  527. });
  528. });
  529. let volume = parseInt(localStorage.getItem("volume"));
  530. volume = (typeof volume === "number" && !isNaN(volume)) ? volume : 20;
  531. localStorage.setItem("volume", volume);
  532. $("#volumeSlider").val(volume);
  533. },
  534. components: {
  535. OfficialHeader,
  536. CommunityHeader,
  537. SongQueue,
  538. EditPlaylist,
  539. CreatePlaylist,
  540. EditStation,
  541. Report,
  542. SongsListSidebar,
  543. PlaylistSidebar,
  544. UsersSidebar
  545. }
  546. }
  547. </script>
  548. <style lang="scss">
  549. .no-song {
  550. color: #03A9F4;
  551. text-align: center;
  552. }
  553. #volumeSlider {
  554. padding: 0 15px;
  555. background: transparent;
  556. }
  557. .volume-slider-wrapper {
  558. margin-top: 0;
  559. position: relative;
  560. display: flex;
  561. align-items: center;
  562. }
  563. .material-icons { cursor: pointer; }
  564. .stationDisplayName {
  565. color: white !important;
  566. }
  567. .slideout {
  568. top: 50px;
  569. height: 100%;
  570. position: fixed;
  571. right: 0;
  572. width: 350px;
  573. background-color: white;
  574. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  575. .slideout-header {
  576. text-align: center;
  577. background-color: rgb(3, 169, 244) !important;
  578. margin: 0;
  579. padding-top: 5px;
  580. padding-bottom: 7px;
  581. color: white;
  582. }
  583. .slideout-content {
  584. height: 100%;
  585. }
  586. }
  587. .modal-large {
  588. width: 75%;
  589. }
  590. .station {
  591. flex: 1 0 auto;
  592. padding-top: 0.5vw;
  593. transition: all 0.1s;
  594. margin: 0 auto;
  595. max-width: 1280px;
  596. width: 90%;
  597. @media only screen and (min-width: 993px) {
  598. width: 70%;
  599. }
  600. @media only screen and (min-width: 601px) {
  601. width: 85%;
  602. }
  603. input[type=range] {
  604. -webkit-appearance: none;
  605. width: 100%;
  606. margin: 7.3px 0;
  607. }
  608. input[type=range]:focus {
  609. outline: none;
  610. }
  611. input[type=range]::-webkit-slider-runnable-track {
  612. width: 100%;
  613. height: 5.2px;
  614. cursor: pointer;
  615. box-shadow: 0;
  616. background: #c2c0c2;
  617. border-radius: 0;
  618. border: 0;
  619. }
  620. input[type=range]::-webkit-slider-thumb {
  621. box-shadow: 0;
  622. border: 0;
  623. height: 19px;
  624. width: 19px;
  625. border-radius: 15px;
  626. background: #03a9f4;
  627. cursor: pointer;
  628. -webkit-appearance: none;
  629. margin-top: -6.5px;
  630. }
  631. input[type=range]::-moz-range-track {
  632. width: 100%;
  633. height: 5.2px;
  634. cursor: pointer;
  635. box-shadow: 0;
  636. background: #c2c0c2;
  637. border-radius: 0;
  638. border: 0;
  639. }
  640. input[type=range]::-moz-range-thumb {
  641. box-shadow: 0;
  642. border: 0;
  643. height: 19px;
  644. width: 19px;
  645. border-radius: 15px;
  646. background: #03a9f4;
  647. cursor: pointer;
  648. -webkit-appearance: none;
  649. margin-top: -6.5px;
  650. }
  651. input[type=range]::-ms-track {
  652. width: 100%;
  653. height: 5.2px;
  654. cursor: pointer;
  655. box-shadow: 0;
  656. background: #c2c0c2;
  657. border-radius: 1.3px;
  658. }
  659. input[type=range]::-ms-fill-lower {
  660. background: #c2c0c2;
  661. border: 0;
  662. border-radius: 0;
  663. box-shadow: 0;
  664. }
  665. input[type=range]::-ms-fill-upper {
  666. background: #c2c0c2;
  667. border: 0;
  668. border-radius: 0;
  669. box-shadow: 0;
  670. }
  671. input[type=range]::-ms-thumb {
  672. box-shadow: 0;
  673. border: 0;
  674. height: 15px;
  675. width: 15px;
  676. border-radius: 15px;
  677. background: #03a9f4;
  678. cursor: pointer;
  679. -webkit-appearance: none;
  680. margin-top: 1.5px;
  681. }
  682. .video-container {
  683. position: relative;
  684. padding-bottom: 56.25%;
  685. height: 0;
  686. overflow: hidden;
  687. iframe {
  688. position: absolute;
  689. top: 0;
  690. left: 0;
  691. width: 100%;
  692. height: 100%;
  693. }
  694. }
  695. .video-col {
  696. padding-right: 0.75rem;
  697. padding-left: 0.75rem;
  698. }
  699. }
  700. .room-title {
  701. left: 50%;
  702. -webkit-transform: translateX(-50%);
  703. transform: translateX(-50%);
  704. font-size: 2.1em;
  705. }
  706. #ratings {
  707. span {
  708. font-size: 1.68rem;
  709. }
  710. i {
  711. color: #9e9e9e !important;
  712. cursor: pointer;
  713. transition: 0.1s color;
  714. }
  715. }
  716. #time-display {
  717. margin-top: 30px;
  718. float: right;
  719. }
  720. #thumbs_up:hover, #thumbs_up.liked {
  721. color: #87D37C !important;
  722. }
  723. #thumbs_down:hover, #thumbs_down.disliked {
  724. color: #EC644B !important;
  725. }
  726. #song-thumbnail {
  727. max-width: 100%;
  728. width: 85%;
  729. }
  730. .seeker-bar-container {
  731. position: relative;
  732. height: 5px;
  733. display: block;
  734. width: 100%;
  735. overflow: hidden;
  736. }
  737. .seeker-bar {
  738. top: 0;
  739. left: 0;
  740. bottom: 0;
  741. position: absolute;
  742. }
  743. ul {
  744. list-style: none;
  745. margin: 0;
  746. display: block;
  747. }
  748. h1, h2, h3, h4, h5, h6 {
  749. font-weight: 400;
  750. line-height: 1.1;
  751. }
  752. h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {
  753. font-weight: inherit;
  754. }
  755. h1 {
  756. font-size: 4.2rem;
  757. line-height: 110%;
  758. margin: 2.1rem 0 1.68rem 0;
  759. }
  760. h2 {
  761. font-size: 3.56rem;
  762. line-height: 110%;
  763. margin: 1.78rem 0 1.424rem 0;
  764. }
  765. h3 {
  766. font-size: 2.92rem;
  767. line-height: 110%;
  768. margin: 1.46rem 0 1.168rem 0;
  769. }
  770. h4 {
  771. font-size: 2.28rem;
  772. line-height: 110%;
  773. margin: 1.14rem 0 0.912rem 0;
  774. }
  775. h5 {
  776. font-size: 1.64rem;
  777. line-height: 110%;
  778. margin: 0.82rem 0 0.656rem 0;
  779. }
  780. h6 {
  781. font-size: 1rem;
  782. line-height: 110%;
  783. margin: 0.5rem 0 0.4rem 0;
  784. }
  785. .thin {
  786. font-weight: 200;
  787. }
  788. .left {
  789. float: left !important;
  790. }
  791. .right {
  792. float: right !important;
  793. }
  794. .light-blue {
  795. background-color: #03a9f4 !important;
  796. }
  797. .white {
  798. background-color: #FFFFFF !important;
  799. }
  800. .btn-search {
  801. font-size: 14px;
  802. }
  803. .menu { padding: 0 10px; }
  804. .menu-list li a:hover { color: #000 !important; }
  805. .menu-list li {
  806. display: flex;
  807. justify-content: space-between;
  808. }
  809. .menu-list a {
  810. /*padding: 0 10px !important;*/
  811. }
  812. .menu-list a:hover {
  813. background-color : transparent;
  814. }
  815. .icons-group { display: flex; }
  816. #like, #dislike {
  817. position: relative;
  818. }
  819. .behind {
  820. z-index: -1;
  821. }
  822. .behind:focus {
  823. z-index: 0;
  824. }
  825. </style>