OctoPrint-BitBang 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3/OctoPrint_BitBang.egg-info}/PKG-INFO +26 -79
  2. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/OctoPrint_BitBang.egg-info/SOURCES.txt +2 -1
  3. {octoprint_bitbang-0.2.2/OctoPrint_BitBang.egg-info → octoprint_bitbang-0.2.3}/PKG-INFO +26 -79
  4. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/README.md +25 -78
  5. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/__init__.py +1 -1
  6. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/_plugin.py +11 -1
  7. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/bin/bitbang-linux-amd64 +0 -0
  8. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/bin/bitbang-linux-arm64 +0 -0
  9. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/bin/bitbang-linux-armv7 +0 -0
  10. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/static/js/bitbang.js +35 -72
  11. octoprint_bitbang-0.2.3/octoprint_bitbang/templates/bitbang_webcam.jinja2 +2 -0
  12. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/pyproject.toml +1 -1
  13. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/LICENSE +0 -0
  14. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/MANIFEST.in +0 -0
  15. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/OctoPrint_BitBang.egg-info/dependency_links.txt +0 -0
  16. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/OctoPrint_BitBang.egg-info/entry_points.txt +0 -0
  17. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/OctoPrint_BitBang.egg-info/requires.txt +0 -0
  18. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/OctoPrint_BitBang.egg-info/top_level.txt +0 -0
  19. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/__main__.py +0 -0
  20. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/app.py +0 -0
  21. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/camera.py +0 -0
  22. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/flip_track.py +0 -0
  23. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/index.html +0 -0
  24. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/octoprint_adapter.py +0 -0
  25. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/pi_camera_track.py +0 -0
  26. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/pi_h264_source.py +0 -0
  27. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/static/favicon.png +0 -0
  28. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/templates/bitbang_navbar.jinja2 +0 -0
  29. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/templates/bitbang_settings.jinja2 +0 -0
  30. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/usb_camera_source.py +0 -0
  31. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/octoprint_bitbang/v4l2_h264_source.py +0 -0
  32. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/setup.cfg +0 -0
  33. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OctoPrint-BitBang
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Remote OctoPrint access with live H.264 video via BitBang WebRTC
5
5
  Author-email: Rich LeGrand <rich.m.legrand@gmail.com>
6
6
  License-Expression: MIT
@@ -55,76 +55,55 @@ This is part of the [BitBang project](https://github.com/richlegrand/bitbang).
55
55
 
56
56
  ## Installation
57
57
 
58
- ### Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
59
-
60
- In OctoPrint: **Settings → Plugin Manager → Get More**, search for **BitBang**, click **Install**.
61
-
62
- ### Plugin Manager, install from URL
63
-
64
- **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
65
-
66
- ```
67
- https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
68
- ```
69
-
70
- Click **Install**, then restart OctoPrint when prompted.
71
-
72
- ### pip
73
-
74
- Inside your OctoPrint venv:
58
+ 1. Install from PyPI:
75
59
 
76
60
  ```bash
77
61
  pip install OctoPrint-BitBang
78
62
  ```
79
63
 
80
- Restart OctoPrint.
64
+ Don't install from the GitHub source zip — it omits the bundled proxy binaries, so remote access and video won't work.
81
65
 
82
- > **Pi CSI camera:** `picamera2` (the Pi camera driver) is a system package, so the venv must be created with `python3 -m venv --system-site-packages` to see it. Without that, the CSI camera isn't detected and the plugin falls back to USB. USB webcams aren't affected -- details in [Installation Notes](#installation-notes).
66
+ On 32-bit Raspberry Pi OS (`armv7l`, the standard OctoPi image), run these commands first:
83
67
 
84
- ### Did it work?
85
-
86
- After OctoPrint restarts, you should see a **BitBang** button in the navbar and a new **BitBang** entry in Settings. If both are there, you're done -- continue to [Usage](#usage).
87
-
88
- If the plugin doesn't show up, or `octoprint.log` contains `BitBang plugin not loaded` or `BitBang video stack unavailable`, see [Installation Notes](#installation-notes) -- usually a pre-3.10 Python image, or (on 32-bit) an `aiortc`/`libvpx` mismatch that needs one extra step.
68
+ ```bash
69
+ sudo apt install -y libvpx-dev libopus-dev libsrtp2-dev
70
+ ~/oprint/bin/pip install --no-binary aiortc,pylibsrtp --force-reinstall --no-deps aiortc==1.10.1 pylibsrtp==1.0.0
71
+ ```
89
72
 
90
- ## Usage
73
+ 64-bit and x86_64 need nothing further.
91
74
 
92
- 1. If you are using a separate program for camera streaming (e.g. camera-streamer, mjpg-streamer, ustreamer) you should stop these processes before running BitBang plugin to avoid camera access contention. See commands below.
75
+ 2. Free the camera from OctoPi's default streamer:
93
76
 
94
- Stable octopi stack:
95
77
  ```bash
96
- sudo systemctl stop webcamd
97
- sudo systemctl stop ffmpeg_hls
98
- sudo systemctl disable webcamd
99
- sudo systemctl disable ffmpeg_hls
78
+ sudo systemctl disable --now webcamd ffmpeg_hls camera_streamer
79
+ sudo systemctl restart octoprint
100
80
  ```
101
81
 
102
- New camera stack:
103
- ```bash
104
- sudo systemctl stop camera-streamer
105
- sudo systemctl disable camera-streamer
106
- ```
82
+ 3. Restart OctoPrint (usually with `sudo systemctl restart octoprint`).
83
+
84
+ 4. Point your browser to your OctoPrint server, open the Control tab, and choose **BitBang Camera** from the webcam selector at the top-right.
107
85
 
108
- 2. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
109
- 3. Choose camera from dropdown.
86
+ 5. Open **Settings BitBang** and choose camera from dropdown.
110
87
 
111
88
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
112
89
 
113
- 4. Choose resolution.
90
+ 6. Choose resolution.
114
91
 
115
92
  ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
116
93
 
117
- 5. Set a PIN (Optional).
118
- 6. Save and **restart OctoPrint**.
119
- 7. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
94
+
95
+ 7. Save and **restart OctoPrint**.
96
+
97
+ 8. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
120
98
 
121
99
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
122
100
 
123
101
  ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
124
102
 
125
-
126
103
  This URL allows remote access to your printer.
127
104
 
105
+ 9. Set `Snapshot Webcam` in **Settings → Webcam and Timelapse** to `BitBang Camera` if you want timelapse video/images of your prints.
106
+
128
107
  ## Configuration
129
108
 
130
109
  All settings live in **Settings → BitBang**:
@@ -142,7 +121,7 @@ All settings take effect on OctoPrint restart. Full-screen button and brightness
142
121
  ## How it works
143
122
 
144
123
  - The `bitbang-python` package handles WebRTC signaling, identity, and the ASGI interface.
145
- - This plugin wraps it with OctoPrint integration: settings UI, `WebcamProviderPlugin` hooks, camera auto-detect, CSRF-safe cookie handling, and the JavaScript that injects the `<video>` element into OctoPrint's Control tab.
124
+ - This plugin wraps it with OctoPrint integration: settings UI, `WebcamProviderPlugin` hooks, camera auto-detect, CSRF-safe cookie handling, and a webcam-provider template that renders the H.264 `<video>` in OctoPrint's Control tab.
146
125
  - The bitba.ng cloud acts purely as a signaling relay to broker a direct connection. If a direct connection isn't available, bitba.ng will use TURN instead.
147
126
 
148
127
  ## Privacy
@@ -169,41 +148,9 @@ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the f
169
148
 
170
149
  ## Installation Notes
171
150
 
172
- If the basic [Installation](#installation) worked, skip this section.
173
-
174
- The video stack depends on `av` ([PyAV](https://github.com/PyAV-Org/PyAV)) and `aiortc`, installed as prebuilt wheels. As of v0.1.7 the plugin pins them (`aiortc<1.11`, and `av<12` on 32-bit ARM) so pip resolves to versions that work on current OctoPi -- **including the 32-bit stable image**:
175
-
176
- - **64-bit Linux** (`aarch64`/`x86_64`) -- PyPI ships `av` wheels with FFmpeg bundled; nothing system-level needed.
177
- - **32-bit Raspberry Pi OS** (`armv7l`) -- [piwheels](https://www.piwheels.org/) ships an `av` wheel built against the **system FFmpeg 5.1**, and the `av<12` pin selects it. Supported, with one possible extra step (see below).
178
- - **Python 3.10+** is required either way (`av` wheels start at cp310).
179
-
180
- ### Quick check
181
-
182
- ```bash
183
- uname -m # aarch64 = 64-bit Pi; armv7l = 32-bit (also supported)
184
- python --version # must be 3.10 or newer
185
- ```
186
-
187
- ### By OctoPi version
188
-
189
- | Version | Notes |
190
- |---|---|
191
- | **1.1.0** | Bookworm + Python 3.11. The **stable image is 32-bit** (`armv7l`) on every Pi model; 64-bit is nightly-only. v0.1.7 supports both. |
192
- | **1.0.x** | Bullseye + Python 3.9 -- below the 3.10 minimum. Upgrade to 1.1.0. |
193
- | **Pre-1.0** | Older base. Upgrade. |
194
-
195
- ### 32-bit: aiortc / libvpx mismatch
196
-
197
- On some 32-bit images the piwheels `aiortc` wheel is built against a newer `libvpx` than the OS ships, so `octoprint.log` shows `BitBang video stack unavailable: libvpx.so.9: cannot open shared object file`. Install the codec dev headers and rebuild aiortc against the system libvpx (in your OctoPrint venv):
198
-
199
- ```bash
200
- sudo apt install -y libvpx-dev libopus-dev
201
- pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
202
- ```
203
-
204
- ### Old Python (3.9 or earlier)
151
+ Skip this if [Installation](#installation) worked.
205
152
 
206
- `av` wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
153
+ The video stack is `av` ([PyAV](https://github.com/PyAV-Org/PyAV)) + `aiortc`, pulled in as wheels, and needs **Python 3.10+** OctoPi 1.0.x (Bullseye / Python 3.9) has no usable `av` wheel, so upgrade the image to 1.1.0+. On **64-bit** (`aarch64` / `x86_64`) the PyPI wheels bundle their native libraries and work as-is; **32-bit** (`armv7l`) needs the extra step in [Installation](#installation) above, because its [piwheels](https://www.piwheels.org/) wheels link newer system libraries than Bookworm ships.
207
154
 
208
155
  ### Pi CSI camera not detected (falls back to USB)
209
156
 
@@ -27,4 +27,5 @@ octoprint_bitbang/bin/bitbang-linux-armv7
27
27
  octoprint_bitbang/static/favicon.png
28
28
  octoprint_bitbang/static/js/bitbang.js
29
29
  octoprint_bitbang/templates/bitbang_navbar.jinja2
30
- octoprint_bitbang/templates/bitbang_settings.jinja2
30
+ octoprint_bitbang/templates/bitbang_settings.jinja2
31
+ octoprint_bitbang/templates/bitbang_webcam.jinja2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OctoPrint-BitBang
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Remote OctoPrint access with live H.264 video via BitBang WebRTC
5
5
  Author-email: Rich LeGrand <rich.m.legrand@gmail.com>
6
6
  License-Expression: MIT
@@ -55,76 +55,55 @@ This is part of the [BitBang project](https://github.com/richlegrand/bitbang).
55
55
 
56
56
  ## Installation
57
57
 
58
- ### Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
59
-
60
- In OctoPrint: **Settings → Plugin Manager → Get More**, search for **BitBang**, click **Install**.
61
-
62
- ### Plugin Manager, install from URL
63
-
64
- **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
65
-
66
- ```
67
- https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
68
- ```
69
-
70
- Click **Install**, then restart OctoPrint when prompted.
71
-
72
- ### pip
73
-
74
- Inside your OctoPrint venv:
58
+ 1. Install from PyPI:
75
59
 
76
60
  ```bash
77
61
  pip install OctoPrint-BitBang
78
62
  ```
79
63
 
80
- Restart OctoPrint.
64
+ Don't install from the GitHub source zip — it omits the bundled proxy binaries, so remote access and video won't work.
81
65
 
82
- > **Pi CSI camera:** `picamera2` (the Pi camera driver) is a system package, so the venv must be created with `python3 -m venv --system-site-packages` to see it. Without that, the CSI camera isn't detected and the plugin falls back to USB. USB webcams aren't affected -- details in [Installation Notes](#installation-notes).
66
+ On 32-bit Raspberry Pi OS (`armv7l`, the standard OctoPi image), run these commands first:
83
67
 
84
- ### Did it work?
85
-
86
- After OctoPrint restarts, you should see a **BitBang** button in the navbar and a new **BitBang** entry in Settings. If both are there, you're done -- continue to [Usage](#usage).
87
-
88
- If the plugin doesn't show up, or `octoprint.log` contains `BitBang plugin not loaded` or `BitBang video stack unavailable`, see [Installation Notes](#installation-notes) -- usually a pre-3.10 Python image, or (on 32-bit) an `aiortc`/`libvpx` mismatch that needs one extra step.
68
+ ```bash
69
+ sudo apt install -y libvpx-dev libopus-dev libsrtp2-dev
70
+ ~/oprint/bin/pip install --no-binary aiortc,pylibsrtp --force-reinstall --no-deps aiortc==1.10.1 pylibsrtp==1.0.0
71
+ ```
89
72
 
90
- ## Usage
73
+ 64-bit and x86_64 need nothing further.
91
74
 
92
- 1. If you are using a separate program for camera streaming (e.g. camera-streamer, mjpg-streamer, ustreamer) you should stop these processes before running BitBang plugin to avoid camera access contention. See commands below.
75
+ 2. Free the camera from OctoPi's default streamer:
93
76
 
94
- Stable octopi stack:
95
77
  ```bash
96
- sudo systemctl stop webcamd
97
- sudo systemctl stop ffmpeg_hls
98
- sudo systemctl disable webcamd
99
- sudo systemctl disable ffmpeg_hls
78
+ sudo systemctl disable --now webcamd ffmpeg_hls camera_streamer
79
+ sudo systemctl restart octoprint
100
80
  ```
101
81
 
102
- New camera stack:
103
- ```bash
104
- sudo systemctl stop camera-streamer
105
- sudo systemctl disable camera-streamer
106
- ```
82
+ 3. Restart OctoPrint (usually with `sudo systemctl restart octoprint`).
83
+
84
+ 4. Point your browser to your OctoPrint server, open the Control tab, and choose **BitBang Camera** from the webcam selector at the top-right.
107
85
 
108
- 2. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
109
- 3. Choose camera from dropdown.
86
+ 5. Open **Settings BitBang** and choose camera from dropdown.
110
87
 
111
88
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
112
89
 
113
- 4. Choose resolution.
90
+ 6. Choose resolution.
114
91
 
115
92
  ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
116
93
 
117
- 5. Set a PIN (Optional).
118
- 6. Save and **restart OctoPrint**.
119
- 7. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
94
+
95
+ 7. Save and **restart OctoPrint**.
96
+
97
+ 8. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
120
98
 
121
99
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
122
100
 
123
101
  ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
124
102
 
125
-
126
103
  This URL allows remote access to your printer.
127
104
 
105
+ 9. Set `Snapshot Webcam` in **Settings → Webcam and Timelapse** to `BitBang Camera` if you want timelapse video/images of your prints.
106
+
128
107
  ## Configuration
129
108
 
130
109
  All settings live in **Settings → BitBang**:
@@ -142,7 +121,7 @@ All settings take effect on OctoPrint restart. Full-screen button and brightness
142
121
  ## How it works
143
122
 
144
123
  - The `bitbang-python` package handles WebRTC signaling, identity, and the ASGI interface.
145
- - This plugin wraps it with OctoPrint integration: settings UI, `WebcamProviderPlugin` hooks, camera auto-detect, CSRF-safe cookie handling, and the JavaScript that injects the `<video>` element into OctoPrint's Control tab.
124
+ - This plugin wraps it with OctoPrint integration: settings UI, `WebcamProviderPlugin` hooks, camera auto-detect, CSRF-safe cookie handling, and a webcam-provider template that renders the H.264 `<video>` in OctoPrint's Control tab.
146
125
  - The bitba.ng cloud acts purely as a signaling relay to broker a direct connection. If a direct connection isn't available, bitba.ng will use TURN instead.
147
126
 
148
127
  ## Privacy
@@ -169,41 +148,9 @@ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the f
169
148
 
170
149
  ## Installation Notes
171
150
 
172
- If the basic [Installation](#installation) worked, skip this section.
173
-
174
- The video stack depends on `av` ([PyAV](https://github.com/PyAV-Org/PyAV)) and `aiortc`, installed as prebuilt wheels. As of v0.1.7 the plugin pins them (`aiortc<1.11`, and `av<12` on 32-bit ARM) so pip resolves to versions that work on current OctoPi -- **including the 32-bit stable image**:
175
-
176
- - **64-bit Linux** (`aarch64`/`x86_64`) -- PyPI ships `av` wheels with FFmpeg bundled; nothing system-level needed.
177
- - **32-bit Raspberry Pi OS** (`armv7l`) -- [piwheels](https://www.piwheels.org/) ships an `av` wheel built against the **system FFmpeg 5.1**, and the `av<12` pin selects it. Supported, with one possible extra step (see below).
178
- - **Python 3.10+** is required either way (`av` wheels start at cp310).
179
-
180
- ### Quick check
181
-
182
- ```bash
183
- uname -m # aarch64 = 64-bit Pi; armv7l = 32-bit (also supported)
184
- python --version # must be 3.10 or newer
185
- ```
186
-
187
- ### By OctoPi version
188
-
189
- | Version | Notes |
190
- |---|---|
191
- | **1.1.0** | Bookworm + Python 3.11. The **stable image is 32-bit** (`armv7l`) on every Pi model; 64-bit is nightly-only. v0.1.7 supports both. |
192
- | **1.0.x** | Bullseye + Python 3.9 -- below the 3.10 minimum. Upgrade to 1.1.0. |
193
- | **Pre-1.0** | Older base. Upgrade. |
194
-
195
- ### 32-bit: aiortc / libvpx mismatch
196
-
197
- On some 32-bit images the piwheels `aiortc` wheel is built against a newer `libvpx` than the OS ships, so `octoprint.log` shows `BitBang video stack unavailable: libvpx.so.9: cannot open shared object file`. Install the codec dev headers and rebuild aiortc against the system libvpx (in your OctoPrint venv):
198
-
199
- ```bash
200
- sudo apt install -y libvpx-dev libopus-dev
201
- pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
202
- ```
203
-
204
- ### Old Python (3.9 or earlier)
151
+ Skip this if [Installation](#installation) worked.
205
152
 
206
- `av` wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
153
+ The video stack is `av` ([PyAV](https://github.com/PyAV-Org/PyAV)) + `aiortc`, pulled in as wheels, and needs **Python 3.10+** OctoPi 1.0.x (Bullseye / Python 3.9) has no usable `av` wheel, so upgrade the image to 1.1.0+. On **64-bit** (`aarch64` / `x86_64`) the PyPI wheels bundle their native libraries and work as-is; **32-bit** (`armv7l`) needs the extra step in [Installation](#installation) above, because its [piwheels](https://www.piwheels.org/) wheels link newer system libraries than Bookworm ships.
207
154
 
208
155
  ### Pi CSI camera not detected (falls back to USB)
209
156
 
@@ -22,76 +22,55 @@ This is part of the [BitBang project](https://github.com/richlegrand/bitbang).
22
22
 
23
23
  ## Installation
24
24
 
25
- ### Plugin Manager (recommended, once accepted into the OctoPrint plugin registry)
26
-
27
- In OctoPrint: **Settings → Plugin Manager → Get More**, search for **BitBang**, click **Install**.
28
-
29
- ### Plugin Manager, install from URL
30
-
31
- **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
32
-
33
- ```
34
- https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
35
- ```
36
-
37
- Click **Install**, then restart OctoPrint when prompted.
38
-
39
- ### pip
40
-
41
- Inside your OctoPrint venv:
25
+ 1. Install from PyPI:
42
26
 
43
27
  ```bash
44
28
  pip install OctoPrint-BitBang
45
29
  ```
46
30
 
47
- Restart OctoPrint.
31
+ Don't install from the GitHub source zip — it omits the bundled proxy binaries, so remote access and video won't work.
48
32
 
49
- > **Pi CSI camera:** `picamera2` (the Pi camera driver) is a system package, so the venv must be created with `python3 -m venv --system-site-packages` to see it. Without that, the CSI camera isn't detected and the plugin falls back to USB. USB webcams aren't affected -- details in [Installation Notes](#installation-notes).
33
+ On 32-bit Raspberry Pi OS (`armv7l`, the standard OctoPi image), run these commands first:
50
34
 
51
- ### Did it work?
52
-
53
- After OctoPrint restarts, you should see a **BitBang** button in the navbar and a new **BitBang** entry in Settings. If both are there, you're done -- continue to [Usage](#usage).
54
-
55
- If the plugin doesn't show up, or `octoprint.log` contains `BitBang plugin not loaded` or `BitBang video stack unavailable`, see [Installation Notes](#installation-notes) -- usually a pre-3.10 Python image, or (on 32-bit) an `aiortc`/`libvpx` mismatch that needs one extra step.
35
+ ```bash
36
+ sudo apt install -y libvpx-dev libopus-dev libsrtp2-dev
37
+ ~/oprint/bin/pip install --no-binary aiortc,pylibsrtp --force-reinstall --no-deps aiortc==1.10.1 pylibsrtp==1.0.0
38
+ ```
56
39
 
57
- ## Usage
40
+ 64-bit and x86_64 need nothing further.
58
41
 
59
- 1. If you are using a separate program for camera streaming (e.g. camera-streamer, mjpg-streamer, ustreamer) you should stop these processes before running BitBang plugin to avoid camera access contention. See commands below.
42
+ 2. Free the camera from OctoPi's default streamer:
60
43
 
61
- Stable octopi stack:
62
44
  ```bash
63
- sudo systemctl stop webcamd
64
- sudo systemctl stop ffmpeg_hls
65
- sudo systemctl disable webcamd
66
- sudo systemctl disable ffmpeg_hls
45
+ sudo systemctl disable --now webcamd ffmpeg_hls camera_streamer
46
+ sudo systemctl restart octoprint
67
47
  ```
68
48
 
69
- New camera stack:
70
- ```bash
71
- sudo systemctl stop camera-streamer
72
- sudo systemctl disable camera-streamer
73
- ```
49
+ 3. Restart OctoPrint (usually with `sudo systemctl restart octoprint`).
50
+
51
+ 4. Point your browser to your OctoPrint server, open the Control tab, and choose **BitBang Camera** from the webcam selector at the top-right.
74
52
 
75
- 2. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
76
- 3. Choose camera from dropdown.
53
+ 5. Open **Settings BitBang** and choose camera from dropdown.
77
54
 
78
55
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
79
56
 
80
- 4. Choose resolution.
57
+ 6. Choose resolution.
81
58
 
82
59
  ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
83
60
 
84
- 5. Set a PIN (Optional).
85
- 6. Save and **restart OctoPrint**.
86
- 7. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
61
+
62
+ 7. Save and **restart OctoPrint**.
63
+
64
+ 8. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
87
65
 
88
66
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
89
67
 
90
68
  ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
91
69
 
92
-
93
70
  This URL allows remote access to your printer.
94
71
 
72
+ 9. Set `Snapshot Webcam` in **Settings → Webcam and Timelapse** to `BitBang Camera` if you want timelapse video/images of your prints.
73
+
95
74
  ## Configuration
96
75
 
97
76
  All settings live in **Settings → BitBang**:
@@ -109,7 +88,7 @@ All settings take effect on OctoPrint restart. Full-screen button and brightness
109
88
  ## How it works
110
89
 
111
90
  - The `bitbang-python` package handles WebRTC signaling, identity, and the ASGI interface.
112
- - This plugin wraps it with OctoPrint integration: settings UI, `WebcamProviderPlugin` hooks, camera auto-detect, CSRF-safe cookie handling, and the JavaScript that injects the `<video>` element into OctoPrint's Control tab.
91
+ - This plugin wraps it with OctoPrint integration: settings UI, `WebcamProviderPlugin` hooks, camera auto-detect, CSRF-safe cookie handling, and a webcam-provider template that renders the H.264 `<video>` in OctoPrint's Control tab.
113
92
  - The bitba.ng cloud acts purely as a signaling relay to broker a direct connection. If a direct connection isn't available, bitba.ng will use TURN instead.
114
93
 
115
94
  ## Privacy
@@ -136,41 +115,9 @@ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the f
136
115
 
137
116
  ## Installation Notes
138
117
 
139
- If the basic [Installation](#installation) worked, skip this section.
140
-
141
- The video stack depends on `av` ([PyAV](https://github.com/PyAV-Org/PyAV)) and `aiortc`, installed as prebuilt wheels. As of v0.1.7 the plugin pins them (`aiortc<1.11`, and `av<12` on 32-bit ARM) so pip resolves to versions that work on current OctoPi -- **including the 32-bit stable image**:
142
-
143
- - **64-bit Linux** (`aarch64`/`x86_64`) -- PyPI ships `av` wheels with FFmpeg bundled; nothing system-level needed.
144
- - **32-bit Raspberry Pi OS** (`armv7l`) -- [piwheels](https://www.piwheels.org/) ships an `av` wheel built against the **system FFmpeg 5.1**, and the `av<12` pin selects it. Supported, with one possible extra step (see below).
145
- - **Python 3.10+** is required either way (`av` wheels start at cp310).
146
-
147
- ### Quick check
148
-
149
- ```bash
150
- uname -m # aarch64 = 64-bit Pi; armv7l = 32-bit (also supported)
151
- python --version # must be 3.10 or newer
152
- ```
153
-
154
- ### By OctoPi version
155
-
156
- | Version | Notes |
157
- |---|---|
158
- | **1.1.0** | Bookworm + Python 3.11. The **stable image is 32-bit** (`armv7l`) on every Pi model; 64-bit is nightly-only. v0.1.7 supports both. |
159
- | **1.0.x** | Bullseye + Python 3.9 -- below the 3.10 minimum. Upgrade to 1.1.0. |
160
- | **Pre-1.0** | Older base. Upgrade. |
161
-
162
- ### 32-bit: aiortc / libvpx mismatch
163
-
164
- On some 32-bit images the piwheels `aiortc` wheel is built against a newer `libvpx` than the OS ships, so `octoprint.log` shows `BitBang video stack unavailable: libvpx.so.9: cannot open shared object file`. Install the codec dev headers and rebuild aiortc against the system libvpx (in your OctoPrint venv):
165
-
166
- ```bash
167
- sudo apt install -y libvpx-dev libopus-dev
168
- pip install --no-binary aiortc --force-reinstall --no-deps "aiortc<1.11"
169
- ```
170
-
171
- ### Old Python (3.9 or earlier)
118
+ Skip this if [Installation](#installation) worked.
172
119
 
173
- `av` wheels start at Python 3.10, so OctoPi 1.0.x (Python 3.9) has no usable wheel -- upgrade the image to 1.1.0.
120
+ The video stack is `av` ([PyAV](https://github.com/PyAV-Org/PyAV)) + `aiortc`, pulled in as wheels, and needs **Python 3.10+** OctoPi 1.0.x (Bullseye / Python 3.9) has no usable `av` wheel, so upgrade the image to 1.1.0+. On **64-bit** (`aarch64` / `x86_64`) the PyPI wheels bundle their native libraries and work as-is; **32-bit** (`armv7l`) needs the extra step in [Installation](#installation) above, because its [piwheels](https://www.piwheels.org/) wheels link newer system libraries than Bookworm ships.
174
121
 
175
122
  ### Pi CSI camera not detected (falls back to USB)
176
123
 
@@ -5,7 +5,7 @@ No account, no subscription, no port forwarding. One shareable link.
5
5
  """
6
6
 
7
7
  __plugin_name__ = "BitBang"
8
- __plugin_version__ = "0.2.2"
8
+ __plugin_version__ = "0.2.3"
9
9
  __plugin_description__ = "Remote OctoPrint access with live H.264 video via BitBang WebRTC. No account, no port forwarding, one shareable link."
10
10
  __plugin_url__ = "https://github.com/richlegrand/OctoPrint-BitBang"
11
11
  __plugin_author__ = "Rich LeGrand"
@@ -233,7 +233,13 @@ class BitBangPlugin(
233
233
  return None
234
234
  path = os.path.join(os.path.dirname(__file__), "bin", f"bitbang-linux-{arch}")
235
235
  if not os.path.exists(path):
236
- self._logger.warning(f"[video-bridge] bundled Go binary missing: {path}")
236
+ self._logger.warning(
237
+ f"[video-bridge] bundled Go binary missing: {path} -- remote "
238
+ f"access and video are disabled. The proxy binaries ship only in "
239
+ f"the PyPI package (and CI release artifacts), not the GitHub "
240
+ f"source archive. Reinstall with 'pip install -U OctoPrint-BitBang' "
241
+ f"(or remove + reinstall) to pull it."
242
+ )
237
243
  return None
238
244
  try: # pip/zip don't preserve the exec bit
239
245
  os.chmod(path, os.stat(path).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
@@ -760,6 +766,10 @@ class BitBangPlugin(
760
766
  return [
761
767
  {"type": "settings", "custom_bindings": False},
762
768
  {"type": "navbar", "custom_bindings": False},
769
+ # Render the live view as a proper webcam provider template so
770
+ # OctoPrint shows it only when "BitBang Camera" is the selected
771
+ # webcam -- no DOM-replacing the classic webcam.
772
+ {"type": "webcam", "name": "BitBang Camera", "template": "bitbang_webcam.jinja2"},
763
773
  ]
764
774
 
765
775
  def get_template_vars(self):
@@ -1,11 +1,13 @@
1
1
  /*
2
2
  * OctoPrint-BitBang - H.264 video for OctoPrint
3
3
  *
4
- * Two modes:
5
- * - Remote (via BitBang): replaces MJPEG <img> with <video> wired to
6
- * BitBang's WebRTC stream (bootstrap.js handles the track)
7
- * - Local (direct access): creates a WebRTC peer connection to the
8
- * plugin's /offer endpoint for H.264 video on the LAN
4
+ * The live view is rendered by our webcam provider template
5
+ * (bitbang_webcam.jinja2) as <video id="bitbang-webcam">. This script
6
+ * decorates that element and wires the stream:
7
+ * - Remote (via BitBang): bootstrap.js attaches the WebRTC track via the
8
+ * data-bitbang-stream attribute.
9
+ * - Local (direct access): opens a WebRTC peer connection to the plugin's
10
+ * /offer endpoint for H.264 video on the LAN.
9
11
  */
10
12
  (function () {
11
13
  var isBitBang = !!window.__bbSessionId;
@@ -16,7 +18,9 @@
16
18
 
17
19
  var btn = document.createElement("button");
18
20
  btn.className = "btn btn-mini";
19
- btn.style.cssText = "position:absolute;top:8px;right:8px;z-index:10;opacity:0.6;cursor:pointer;pointer-events:auto";
21
+ // Lower-left: clear of OctoPrint's webcam switcher (top-right) and our
22
+ // brightness slider (bottom-right).
23
+ btn.style.cssText = "position:absolute;bottom:8px;left:8px;z-index:10;opacity:0.6;cursor:pointer;pointer-events:auto";
20
24
  btn.innerHTML = '<i class="fas fa-expand"></i>';
21
25
  btn.title = "Fullscreen";
22
26
  btn.onmouseover = function () { btn.style.opacity = "1"; };
@@ -183,43 +187,21 @@
183
187
  video.addEventListener("resize", reflow);
184
188
  }
185
189
 
186
- function replaceWebcam(video) {
190
+ // Decorate the <video> element OctoPrint renders from our webcam provider
191
+ // template (bitbang_webcam.jinja2): sizing, fullscreen button, status overlay
192
+ // and the brightness control. We no longer touch the classic webcam's DOM --
193
+ // OctoPrint shows our template only when "BitBang Camera" is the selected webcam.
194
+ function decorateVideo(video) {
195
+ if (video.dataset.bbDecorated) return;
196
+ video.dataset.bbDecorated = "1";
197
+ video.autoplay = true;
198
+ video.playsInline = true;
199
+ video.muted = true;
187
200
  video.style.backgroundColor = "#000";
188
201
  applyVideoSizing(video);
189
-
190
- // OctoPrint 1.11+ Classic Webcam hides its default containers until
191
- // a stream URL is configured. Mount into the outer container so
192
- // we're visible regardless of the user's webcam settings.
193
- var classicContainer = document.getElementById("classicwebcam_container");
194
- if (classicContainer) {
195
- // Knockout visibility bindings on classicwebcam's built-in
196
- // containers keep re-showing them, so use a stylesheet rule
197
- // which beats Knockout's inline style.display assignments.
198
- if (!document.getElementById("bitbang-hide-classicwebcam")) {
199
- var style = document.createElement("style");
200
- style.id = "bitbang-hide-classicwebcam";
201
- style.textContent =
202
- "#webcam_video_container, #webcam_img_container " +
203
- "{ display: none !important; }" +
204
- "#classicwebcam_container " +
205
- "{ padding: 0 !important; line-height: 0 !important; font-size: 0 !important; }";
206
- document.head.appendChild(style);
207
- }
208
- classicContainer.appendChild(video);
209
- addFullscreenButton(video);
210
- addStatusOverlay(video);
211
- applyCameraConfig(video);
212
- return true;
213
- }
214
-
215
- // Fallback for other layouts: replace #webcam_image in place.
216
- var img = document.getElementById("webcam_image");
217
- if (!img) return false;
218
- img.parentNode.replaceChild(video, img);
219
202
  addFullscreenButton(video);
220
203
  addStatusOverlay(video);
221
204
  applyCameraConfig(video);
222
- return true;
223
205
  }
224
206
 
225
207
  // Intercept download links that use absolute URLs. OctoPrint
@@ -317,44 +299,25 @@
317
299
  });
318
300
  }
319
301
 
320
- function createVideo(attrs) {
321
- var video = document.createElement("video");
322
- video.autoplay = true;
323
- video.playsInline = true;
324
- video.muted = true;
325
- for (var k in attrs) video.setAttribute(k, attrs[k]);
326
- return video;
327
- }
328
-
329
- function whenWebcamReady(callback) {
330
- if (document.readyState === "loading") {
331
- document.addEventListener("DOMContentLoaded", callback);
332
- } else {
333
- callback();
334
- }
302
+ // Wait for OctoPrint to render our webcam template's
303
+ // <video id="bitbang-webcam">, then hand it to the callback once.
304
+ function whenVideoReady(callback) {
305
+ var existing = document.getElementById("bitbang-webcam");
306
+ if (existing) { callback(existing); return; }
335
307
  var observer = new MutationObserver(function () {
336
- if (document.getElementById("webcam_image") ||
337
- document.getElementById("classicwebcam_container")) {
338
- callback();
339
- }
308
+ var el = document.getElementById("bitbang-webcam");
309
+ if (el) { observer.disconnect(); callback(el); }
340
310
  });
341
311
  observer.observe(document.body, { childList: true, subtree: true });
342
312
  }
343
313
 
344
- if (isBitBang) {
345
- // Remote mode: bootstrap.js wires the track via data-bitbang-stream
346
- whenWebcamReady(function () {
347
- if (document.querySelector("video[data-bitbang-stream]")) return;
348
- var video = createVideo({"data-bitbang-stream": "camera"});
349
- replaceWebcam(video);
350
- });
351
- } else {
352
- // Local mode: direct WebRTC to the plugin's signaling endpoint
353
- whenWebcamReady(function () {
354
- if (document.querySelector("video[data-bitbang-local]")) return;
355
- var video = createVideo({"data-bitbang-local": "1"});
356
- if (!replaceWebcam(video)) return;
314
+ whenVideoReady(function (video) {
315
+ decorateVideo(video);
316
+ // Remote (via BitBang URL): bootstrap.js attaches the WebRTC track
317
+ // through the data-bitbang-stream attribute already on the element.
318
+ // Local (direct LAN access): open a peer connection to /offer.
319
+ if (!isBitBang) {
357
320
  connectLocalVideo(video);
358
- });
359
- }
321
+ }
322
+ });
360
323
  })();
@@ -0,0 +1,2 @@
1
+ <video id="bitbang-webcam" data-bitbang-stream="camera" autoplay playsinline muted
2
+ style="width:100%;height:auto;display:block;background:#000;"></video>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "OctoPrint-BitBang"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Remote OctoPrint access with live H.264 video via BitBang WebRTC"
9
9
  readme = "README.md"
10
10
  license = "MIT"