From 46ad514a70918f4ab6f26ea6f9a6a1ecee9fdc87 Mon Sep 17 00:00:00 2001 From: Joren de Graaf Date: Fri, 2 Oct 2026 21:45:24 +0200 Subject: [PATCH] browser audio detection phase 4 --- README.md | 16 + .../includes/audio_upload_form.html | 11 +- fireworks_detect/test_browser_processing.py | 11 + frontend/src/scripts/audio-upload.js | 139 ++++- .../scripts/browser-submission-processor.js | 37 +- frontend/src/styles/pages/fireworks-home.css | 5 + frontend/tests/audio-upload-mode.test.mjs | 84 +++ .../tests/browser-submission-gate.test.mjs | 35 ++ .../browser-submission-processor.test.mjs | 28 + locale/nl/LC_MESSAGES/django.mo | Bin 25985 -> 26869 bytes locale/nl/LC_MESSAGES/django.po | 12 + package-lock.json | 545 ++++++++++++++++++ package.json | 1 + .../browser-submission-processor-DnWC3kTF.js | 2 + .../browser-yamnet-classifier-B6qH2Np3.js | 1 + .../assets/ffmpeg-video-extractor-CxJ6oLSl.js | 1 + .../vite/assets/fireworks-home-CoAZidqN.css | 1 + .../src/entries/dashboard.js-BdUpQ8E9.js | 1 + .../src/entries/fireworks-home.js-DBkY8wwM.js | 2 + templates/js_translations.html | 2 + 20 files changed, 903 insertions(+), 31 deletions(-) create mode 100644 frontend/tests/audio-upload-mode.test.mjs create mode 100644 staticfiles/vite/assets/browser-submission-processor-DnWC3kTF.js create mode 100644 staticfiles/vite/assets/browser-yamnet-classifier-B6qH2Np3.js create mode 100644 staticfiles/vite/assets/ffmpeg-video-extractor-CxJ6oLSl.js create mode 100644 staticfiles/vite/assets/fireworks-home-CoAZidqN.css create mode 100644 staticfiles/vite/assets/frontend/src/entries/dashboard.js-BdUpQ8E9.js create mode 100644 staticfiles/vite/assets/frontend/src/entries/fireworks-home.js-DBkY8wwM.js diff --git a/README.md b/README.md index f6eb0b7..07d3cf7 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,19 @@ python manage.py compilemessages ``` The small amount of JavaScript UI text is translated by Django in `templates/js_translations.html` and read from `window.BOOMCAST_I18N`. After changing JavaScript, run `npm run build` and `python manage.py collectstatic --noinput` for production. Classifier class names, API keys, sensor tokens, H3 values and stored source/status values remain language-neutral. + +## Browser Processing Beta + +The administrator setting `browser_processing_beta_enabled` is off by default. +When enabled, the upload form shows **Process recording in this browser (Beta)**, +which also starts off. With the user toggle off, ordinary audio uses the +existing server upload and classifier. With it on, selected audio is checked +locally and selected video is converted to 16 kHz mono WAV before the local +check. Files the user submits still run through the server classifier. +Switching back to server mode cancels browser work and clears the local gate. +The server upload endpoint currently accepts audio, so a video selected in +server mode requires an audio file or browser mode. + +Browser assets are loaded only after the user enables the toggle and selects a +file. Regenerate the self-hosted model using [the YAMNet build guide](scripts/BROWSER_YAMNET.md), +then run `npm run build` and `python manage.py collectstatic --noinput`. diff --git a/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html b/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html index 9010138..057e16a 100644 --- a/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html +++ b/fireworks_detect/templates/fireworks_detect/includes/audio_upload_form.html @@ -2,7 +2,7 @@
{% csrf_token %} + {% if browser_processing_config.browserProcessingBeta %} +
+ +

{% trans "When enabled, BoomCast extracts and checks audio on this device before uploading it. When disabled, recordings are processed by the server as usual." %}

+
+ {% endif %}