content/hifi-public/tony/webBridgeTest.html
Dale Glass 0d14e5a379 Initial data.
Needs a lot of cleanup. Data has been de-duplicated, and where identical copies existed, one of them
has been replaced with a symlink.

Some files have been excluded, such as binaries, installers and debug dumps. Some of that may still
be present.
2022-02-13 18:59:11 +01:00

57 lines
1.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$(document).ready(function () {
// hook up a handler for events that come from hifi.
EventBridge.scriptEventReceived.connect(function (msg) {
console.log("WEB: recv script event = " + JSON.stringify(msg));
if (msg === "button-1-done") {
// re-enable the button now that the audio is complete
$("#button-1").removeClass("ui-disabled");
} else if (msg === "button-2-done") {
// re-enable the button now that the audio is complete
$("#button-2").removeClass("ui-disabled");
}
});
// hook up a click handler for button-1
$("#button-1").click(function () {
console.log("WEB: emit web event = " + JSON.stringify("button-1-play"));
// disable the button until we receive a done message.
$("#button-1").addClass("ui-disabled");
// send a play event to hifi
EventBridge.emitWebEvent("button-1-play");
});
// hook up a click handler for button-2
$("#button-2").click(function () {
console.log("WEB: emit web event = " + JSON.stringify("button-2-play"));
// disable the button until we receive a done message.
$("#button-2").addClass("ui-disabled");
// send a play event to hifi
EventBridge.emitWebEvent("button-2-play");
});
});
</script>
<head>
<meta charset="utf-8" />
<body>
<div style="margin:10px">
<button id="button-1" class="ui-btn ui-corner-all">Sad Trombone</button>
<button id="button-2" class="ui-btn ui-corner-all">Scream!</button>
</div>
</body>
</head>
</html>