summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/static/platform.js
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-04 22:46:00 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-04 22:46:00 +0200
commit652465910dcdcc761aa2e078ff1a82625e2a0aa5 (patch)
tree2378741f73ef0faaf138689ea366febef905e85c /packages/meshbay-hub/src/meshbay_hub/static/platform.js
parent859d7ce71795dcfd5701cb08a684dcef23e7c4c0 (diff)
downloadmeshbay-652465910dcdcc761aa2e078ff1a82625e2a0aa5.tar.gz
feat(android): music keeps playing with the screen off
While a track plays, the page asks the shell to stay awake (playback:keep-alive): on Android the cast's foreground service and visible WebView, with a notification; on desktop a power save blocker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/static/platform.js')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/static/platform.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/static/platform.js b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
index c131495..0174edc 100644
--- a/packages/meshbay-hub/src/meshbay_hub/static/platform.js
+++ b/packages/meshbay-hub/src/meshbay_hub/static/platform.js
@@ -204,6 +204,16 @@ export const folder = {
async forget() { return bridge && bridge.folder ? bridge.folder.forget() : false; },
};
+/**
+ * Music is playing: the shell keeps what playback needs awake (on a phone, the
+ * page itself with the screen off). A no-op in a browser.
+ */
+export const playback = {
+ keepAlive(on) {
+ if (bridge && bridge.playback) bridge.playback.keepAlive(on).catch(() => {});
+ },
+};
+
/** Pick a directory to add as a group root. Returns { path, name } or null. */
export const rootPicker = {
available: Boolean(bridge && bridge.rootPicker),