forked from Blendman974/faceclaw
Add support for buzzer sound effects on iOS
This commit is contained in:
1 parent
1412db8e82
commit
e50da605e0
19 files changed
+211
-48
No files matched your search
@@ -7,9 +7,8 @@ declare const com: any;
|
||||
* through Java statics because those are shared across isolates, unlike any
|
||||
* JS-side state.
|
||||
*
|
||||
* Frame submission only. Glasses-hardware calls (e.g. playBuzzerSequence)
|
||||
* should keep using FaceclawBleCommunicator.getActive() directly, so they
|
||||
* skip cleanly when nothing is connected.
|
||||
* Frame submission only. Buzzer effects use worker-buzzer, which routes to
|
||||
* the platform BLE session and skips playback when disconnected.
|
||||
*/
|
||||
export function getActiveDisplay(): any {
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { WorkerAppReply } from "../ui/shell/worker-window";
|
||||
|
||||
declare const com: any;
|
||||
|
||||
/** Workers use the main-thread BLE session on iOS and the native queue on Android. */
|
||||
export function playWorkerBuzzerSequence(payload: Uint8Array): void {
|
||||
if (global.isIOS) {
|
||||
global.postMessage({ type: "buzzer-sequence", payload: Array.from(payload) } satisfies WorkerAppReply);
|
||||
} else {
|
||||
com.faceclaw.app.FaceclawBleCommunicator.getActive()?.playBuzzerSequence(new Uint8Array(payload).buffer);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user