Villhellm / lovelace-animated-background

Animated backgrounds for lovelace
191 stars 60 forks source link

Force stream to mobile devices or allow force stream to certain ip addresses #33

Closed Maxx57 closed 3 years ago

Maxx57 commented 4 years ago

Your idea as completely as you can describe it I'm running home assistant (0.112.3) and the lovelace ui on a raspberry pi 3b+ using chromium in kiosk mode. Chromium reports that it's a mobile device. This is some how making the animated background perform like it's a mobile app and so there is no background. This is problematic because though I wouldn't want the mp4 to play on an actual mobile device the device I'm using is not a mobile device. I think this issue may be because of chromium. I have opened the videos just fine by hitting the url in a regular browser and they play fine on the same device using another tab. But they will not play in home assistant. I noticed at the end of your documentation that you mentioned adding code that attempts to block video streaming if it detects a mobile device so I'm assuming that's what is preventing it. Is there a way to force it to stream when a certain ip address is requesting it? I only believe that Chromium is reporting that it is a mobile device because I was attempting to run the spotify web player using chromium and it forced me to download the mobile app (which I cannot because it's not a mobile device!) The animated background works just fine on my computer.

Describe the solution you'd like To make this easier, I would suggest either adding a control that would allow me to force override the mobile device logic and just play the videos no matter what. I don't access home assistant via any mobile devices and if I did it would be through wifi anyway so not a big deal. Plus I've downloaded the videos to the device hosting home assistant and they are pulling local files now anyway.

Villhellm commented 4 years ago

The background loads on all devices by default. You would have had to specify an exception for mobile devices to block the loading.

If you don't have any exceptions then it's not loading for a different reason. You can try updating to the latest beta release to see if that fixes it. Otherwise I'll need to know what errors are showing up in the browser log.

Maxx57 commented 3 years ago

You're 100% correct. I'm getting this error in the console:

Uncaught DOMException: Failed to execute 'insertAdjacentHTML' on 'Element': The element has no parent. at renderBackgroundHTML ( http://192.168.1.146:8123/hacsfiles/lovelace-animated-background/animated-background.js:501:19 ) at Object.set hass [as hass] ( http://192.168.1.146:8123/hacsfiles/lovelace-animated-background/animated-background.js:654:11 ) at HTMLElement.value ( http://192.168.1.146:8123/frontend_latest/app.04756a98.js:806:32132) at run ( http://192.168.1.146:8123/hacsfiles/lovelace-animated-background/animated-background.js:636:46 ) at http://192.168.1.146:8123/hacsfiles/lovelace-animated-background/animated-background.js:711:1

Let me know if there's something else I can do to help.

the client browser is being run on a raspberry pi 4 using latest chromium version as of today (Version 78.0.3904.108 (Official Build) Built on Raspbian , running on Raspbian 10 (32-bit))

Thanks!

On Tue, Jul 7, 2020 at 10:14 PM Villhellm notifications@github.com wrote:

The background loads on all devices by default. You would have had to specify an exception for mobile devices to block the loading.

If you don't have any exceptions then it's not loading for a different reason. You can try updating to the latest beta release to see if that fixes it. Otherwise I'll need to know what errors are showing up in the browser log.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Villhellm/lovelace-animated-background/issues/33#issuecomment-655290075, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQS4YX5CCVNGB4JJVLWBLR2P6DHANCNFSM4OUE4HTQ .

Villhellm commented 3 years ago

Upgrade to the latest beta.

Maxx57 commented 3 years ago

Thanks. Will do.

On Fri, Jul 10, 2020, 6:41 AM Villhellm notifications@github.com wrote:

Upgrade to the latest beta.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Villhellm/lovelace-animated-background/issues/33#issuecomment-656683185, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQS4ZK4SGKU3TKG5VE353R24LCBANCNFSM4OUE4HTQ .

Maxx57 commented 3 years ago

so, I don't see any terminology that tells me which is the latest beta other than installing from master branch from HACS. Is that correct? I see there is a fully-fix branch where I can pull the animated-background.js in the dist folder, but that still gave me the error.

On Fri, Jul 10, 2020 at 8:04 AM Perry Nally pnally@gmail.com wrote:

Thanks. Will do.

On Fri, Jul 10, 2020, 6:41 AM Villhellm notifications@github.com wrote:

Upgrade to the latest beta.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Villhellm/lovelace-animated-background/issues/33#issuecomment-656683185, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQS4ZK4SGKU3TKG5VE353R24LCBANCNFSM4OUE4HTQ .

Villhellm commented 3 years ago

You need to enable beta releases in HACS. Find the card and click the three dots, then click reinstall. The switch at the top of the card is for enabling beta releases

Maxx57 commented 3 years ago

ok, that certainly did the trick! Thank you so very much. following the repo to find out when it goes to release version. Let me know if there's something you've been wanting to do but just don't have the time. I'd love to assist you and "buy you coffee's" now and again for you dev time creating this. I'll look to see if you have a donate page available. The work on this you've done really polishes the look and feel of home assistant imo. Thanks again! Perry

On Fri, Jul 10, 2020 at 2:00 PM Villhellm notifications@github.com wrote:

You need to enable beta releases in HACS. Find the card and click the three dots, then click reinstall. The switch at the top of the card is for enabling beta releases

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Villhellm/lovelace-animated-background/issues/33#issuecomment-656888153, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQS4YHUJZ6LNACJV73DPLR256NDANCNFSM4OUE4HTQ .

Villhellm commented 3 years ago

No worries, it should be live pretty soon, I just haven’t had a chance to put it through my various tests yet. I think you opened this issue on the day that it was fixed, so it’s a very new fix. Apparently your version of Chromium has the same bug that Fully had

Villhellm commented 3 years ago

As for financial compensation I don’t think I’ve really done anything deserving of that. Everything is a community effort. I’d much prefer you donate to your charity of choice :)

Maxx57 commented 3 years ago

Well, true that, but its nice to be given a part on the back for keeping the community going. ;) Thanks again.

On Fri, Jul 10, 2020, 2:20 PM Villhellm notifications@github.com wrote:

As for financial compensation I don’t think I’ve really done anything deserving of that. Everything is a community effort. I’d much prefer you donate to your charity of choice :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Villhellm/lovelace-animated-background/issues/33#issuecomment-656896211, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJQS44DZAKH65CSPDV5T6TR26AYZANCNFSM4OUE4HTQ .

Villhellm commented 3 years ago

👍