Silly workaround for apple devices
This commit is contained in:
parent
3f133e4c41
commit
acccacdff1
@ -69,6 +69,8 @@ The `media_player` entity also has some extra attributes presenting the current
|
||||
| `userAgent` | The User Agent of the associated browser. |
|
||||
| `currentUser` | The user currently logged in on the *device*. |
|
||||
|
||||
**NOTE: Because apple is apple; on iOS you need to touch the screen once after loading the frontend before any playback will work.**
|
||||
|
||||
## `browser_mod.command` service
|
||||
|
||||
Call the `browser_mod.command` service to control your *device* in various ways.
|
||||
|
File diff suppressed because one or more lines are too long
@ -28,9 +28,16 @@ class BrowserMod {
|
||||
document.querySelector("home-assistant").hassChanged(hass, hass);
|
||||
}
|
||||
|
||||
playOnce(ev) {
|
||||
if(window.browser_mod.playedOnce) return;
|
||||
window.browser_mod.player.play();
|
||||
window.browser_mod.playedOnce = true;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
window.hassConnection.then((conn) => this.connect(conn.conn));
|
||||
this.player = new Audio();
|
||||
this.playedOnce = false;
|
||||
|
||||
const updater = this.update.bind(this);
|
||||
this.player.addEventListener("ended", updater);
|
||||
@ -39,6 +46,7 @@ class BrowserMod {
|
||||
this.player.addEventListener("volumechange", updater);
|
||||
document.addEventListener("visibilitychange", updater);
|
||||
window.addEventListener("location-changed", updater);
|
||||
window.addEventListener("click", this.playOnce);
|
||||
provideHass(this);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user