also looking at this
iOS: the audio recording pair — ratchet 33 → 31
#98
9 files
+744
-3
| @@ -52,6 +52,7 @@ const char craft_slice_page[] = | ||
| 52 | 52 | "var sentPdfOpen = false, sentPdfClose = false;\n" |
| 53 | 53 | "var sentDownload = false, sentWatch = false, sentSettings = false;\n" |
| 54 | 54 | "var sentBtStart = false, sentBtStop = false;\n" |
| 55 | "var sentRecStart = false, sentRecStop = false;\n" | |
| 55 | 56 | "window.__craftBridgeError = function (ctx) {\n" |
| 56 | 57 | " // The message crossed Zig's escaping with a backslash, quote, and\n" |
| 57 | 58 | " // newline intact; anything mangled and this equality fails, i=7 never\n" |
| @@ -184,6 +185,25 @@ const char craft_slice_page[] = | ||
| 184 | 185 | " // was parsed and routed — and the donation ran without throwing.\n" |
| 185 | 186 | " // A bare string path, landed inside the app container's Documents.\n" |
| 186 | 187 | " // Nothing but a real download-and-move produces it.\n" |
| 188 | " // The recorder is running. Give it a moment of audio before stopping,\n" | |
| 189 | " // or the encoder writes a container with no samples in it.\n" | |
| 190 | " if (!sentRecStart && action === 'startAudioRecording' && payload === true) {\n" | |
| 191 | " sentRecStart = true;\n" | |
| 192 | " bridge.postMessage({t:'mobile', a:'getDeviceInfo', i:62});\n" | |
| 193 | " setTimeout(function () {\n" | |
| 194 | " bridge.postMessage({t:'mobile', a:'stopAudioRecording', i:106});\n" | |
| 195 | " }, 700);\n" | |
| 196 | " }\n" | |
| 197 | " // An M4A the encoder actually produced: 'ftyp' sits at offset 4 of\n" | |
| 198 | " // every ISO base media file, and a stub has no way to emit one.\n" | |
| 199 | " if (!sentRecStop && action === 'stopAudioRecording' && typeof payload === 'string'\n" | |
| 200 | " && payload.indexOf('data:audio/m4a;base64,') === 0) {\n" | |
| 201 | " var raw = atob(payload.slice('data:audio/m4a;base64,'.length));\n" | |
| 202 | " if (raw.slice(4, 8) === 'ftyp' && raw.length > 500) {\n" | |
| 203 | " sentRecStop = true;\n" | |
| 204 | " bridge.postMessage({t:'mobile', a:'getDeviceInfo', i:64});\n" | |
| 205 | " }\n" | |
| 206 | " }\n" | |
| 187 | 207 | " if (!sentBtStop && action === 'stopBluetoothScan' && payload === true) {\n" |
| 188 | 208 | " sentBtStop = true;\n" |
| 189 | 209 | " bridge.postMessage({t:'mobile', a:'getDeviceInfo', i:58});\n" |
| @@ -338,6 +358,7 @@ const char craft_slice_page[] = | ||
| 338 | 358 | " // for the promise Swift drops — and would mask the state refusal this\n" |
| 339 | 359 | " // asserts. The stop goes out once the start has been answered.\n" |
| 340 | 360 | " bridge.postMessage({t:'mobile', a:'startBluetoothScan', i:103});\n" |
| 361 | " bridge.postMessage({t:'mobile', a:'startAudioRecording', i:105});\n" | |
| 341 | 362 | " // A Tier-0 action migrated in this phase, served by Zig directly.\n" |
| 342 | 363 | " bridge.postMessage({t:'mobile', a:'getAppState', i:88});\n" |
| 343 | 364 | " // And one the shim answers by rejecting, to prove the error route.\n" |