Add WIP custom background video feature

This commit is contained in:
David Ralph
2020-10-21 13:22:04 +01:00
parent 78d3384d7e
commit 2f8d5eca21
4 changed files with 19 additions and 3 deletions

View File

@@ -23,8 +23,8 @@ const Update = React.lazy(() => import('./components/modals/Update'));
const renderLoader = () => <div></div>;
export default class App extends React.PureComponent {
constructor(props) {
super(props);
constructor(...args) {
super(...args);
this.state = {
mainModal: false,
updateModal: false

View File

@@ -67,6 +67,7 @@ export default class Background extends React.PureComponent {
const customBackgroundColour = localStorage.getItem('customBackgroundColour');
const customBackground = localStorage.getItem('customBackground');
const favourited = JSON.parse(localStorage.getItem('favourite'));
const customBackgroundVideo = localStorage.getItem('customBackgroundVideo');
if (favourited) {
if (offlineMode === 'true') return this.doOffline();
@@ -83,6 +84,12 @@ export default class Background extends React.PureComponent {
this.setBackground(null, customBackgroundColour, 'false');
} else if (customBackground !== '') { // Local
this.setBackground(customBackground, null, 'false');
} else if (customBackgroundVideo) {
document.getElementById('backgroundImage').innerHTML = `
<video autoplay muted loop id="backgroundVideo">
<source src="${customBackgroundVideo}"/>
</video>`;
document.querySelector('.photoInformation').style.display = 'none'; // Hide the credit
} else { // Online
if (offlineMode === 'true') return this.doOffline();
try { // First we try and get an image from the API...

View File

@@ -8,7 +8,7 @@ export default class Notes extends React.PureComponent {
constructor(...args) {
super(...args);
this.state = {
notes: localStorage.getItem('notes') || ""
notes: localStorage.getItem('notes') || ''
};
}

View File

@@ -83,6 +83,7 @@ body {
from {
opacity: 0;
}
to {
opacity: 1;
}
@@ -100,4 +101,12 @@ body {
::selection {
background-color: #c2c2c2;
}
#backgroundVideo {
position: fixed;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
}