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

@@ -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') || ''
};
}