OctoPrint-BitBang 0.2.2__tar.gz → 0.2.4__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.4/OctoPrint_BitBang.egg-info}/PKG-INFO +29 -75
  2. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/OctoPrint_BitBang.egg-info/SOURCES.txt +2 -1
  3. {octoprint_bitbang-0.2.2/OctoPrint_BitBang.egg-info → octoprint_bitbang-0.2.4}/PKG-INFO +29 -75
  4. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/README.md +28 -74
  5. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/__init__.py +1 -1
  6. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/_plugin.py +11 -1
  7. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/bin/bitbang-linux-amd64 +0 -0
  8. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/bin/bitbang-linux-arm64 +0 -0
  9. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/bin/bitbang-linux-armv7 +0 -0
  10. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/static/js/bitbang.js +35 -72
  11. octoprint_bitbang-0.2.4/octoprint_bitbang/templates/bitbang_webcam.jinja2 +2 -0
  12. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/pyproject.toml +1 -1
  13. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/LICENSE +0 -0
  14. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/MANIFEST.in +0 -0
  15. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/OctoPrint_BitBang.egg-info/dependency_links.txt +0 -0
  16. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/OctoPrint_BitBang.egg-info/entry_points.txt +0 -0
  17. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/OctoPrint_BitBang.egg-info/requires.txt +0 -0
  18. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/OctoPrint_BitBang.egg-info/top_level.txt +0 -0
  19. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/__main__.py +0 -0
  20. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/app.py +0 -0
  21. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/camera.py +0 -0
  22. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/flip_track.py +0 -0
  23. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/index.html +0 -0
  24. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/octoprint_adapter.py +0 -0
  25. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/pi_camera_track.py +0 -0
  26. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/pi_h264_source.py +0 -0
  27. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/static/favicon.png +0 -0
  28. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/templates/bitbang_navbar.jinja2 +0 -0
  29. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/templates/bitbang_settings.jinja2 +0 -0
  30. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/usb_camera_source.py +0 -0
  31. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/octoprint_bitbang/v4l2_h264_source.py +0 -0
  32. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/setup.cfg +0 -0
  33. {octoprint_bitbang-0.2.2 → octoprint_bitbang-0.2.4}/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.4
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,58 +55,42 @@ 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)
58
+ ### Prerequisites
59
59
 
60
- In OctoPrint: **Settings Plugin Manager Get More**, search for **BitBang**, click **Install**.
60
+ These steps are outside the plugin do them first.
61
61
 
62
- ### Plugin Manager, install from URL
62
+ **Free the camera** from OctoPi's default streamer:
63
63
 
64
- **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
65
-
66
- ```
67
- https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
64
+ ```bash
65
+ sudo systemctl disable --now webcamd ffmpeg_hls camera-streamer
68
66
  ```
69
67
 
70
- Click **Install**, then restart OctoPrint when prompted.
71
-
72
- ### pip
73
-
74
- Inside your OctoPrint venv:
68
+ **32-bit Raspberry Pi OS** (`armv7l`, the standard OctoPi image) also needs `aiortc` and `pylibsrtp` rebuilt once, because its [piwheels](https://www.piwheels.org/) wheels link newer system libraries than Bookworm ships:
75
69
 
76
70
  ```bash
77
- pip install OctoPrint-BitBang
71
+ sudo apt install -y libvpx-dev libopus-dev libsrtp2-dev
72
+ ~/oprint/bin/pip install --no-binary aiortc,pylibsrtp --force-reinstall --no-deps aiortc==1.10.1 pylibsrtp==1.0.0
78
73
  ```
79
74
 
80
- Restart OctoPrint.
81
-
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).
75
+ 64-bit and x86_64 need nothing further.
83
76
 
84
- ### Did it work?
77
+ ### Install the plugin
85
78
 
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).
79
+ In OctoPrint, open **Settings Plugin Manager Get More**, choose **... from URL**, and paste:
87
80
 
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.
81
+ ```
82
+ https://github.com/richlegrand/OctoPrint-BitBang/releases/latest/download/release.zip
83
+ ```
89
84
 
90
- ## Usage
85
+ Once the plugin is accepted into OctoPrint's repository you'll also be able to find it by searching for "BitBang". Prefer the command line? `~/oprint/bin/pip install OctoPrint-BitBang` installs the same package. Either way, don't install from the GitHub source zip — it omits the bundled proxy binaries, so remote access and video won't work.
91
86
 
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.
87
+ ### Set up the camera
93
88
 
94
- Stable octopi stack:
95
- ```bash
96
- sudo systemctl stop webcamd
97
- sudo systemctl stop ffmpeg_hls
98
- sudo systemctl disable webcamd
99
- sudo systemctl disable ffmpeg_hls
100
- ```
89
+ 1. Restart OctoPrint to load the plugin — `sudo systemctl restart octoprint` (Plugin Manager offers to do this for you).
101
90
 
102
- New camera stack:
103
- ```bash
104
- sudo systemctl stop camera-streamer
105
- sudo systemctl disable camera-streamer
106
- ```
91
+ 2. Point your browser to your OctoPrint server, open the Control tab, and choose **BitBang Camera** from the webcam selector at the top-right.
107
92
 
108
- 2. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
109
- 3. Choose camera from dropdown.
93
+ 3. Open **Settings BitBang** and choose camera from dropdown.
110
94
 
111
95
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
112
96
 
@@ -114,17 +98,19 @@ sudo systemctl disable camera-streamer
114
98
 
115
99
  ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
116
100
 
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.
101
+
102
+ 5. Save and **restart OctoPrint**.
103
+
104
+ 6. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
120
105
 
121
106
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
122
107
 
123
108
  ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
124
109
 
125
-
126
110
  This URL allows remote access to your printer.
127
111
 
112
+ 7. Set `Snapshot Webcam` in **Settings → Webcam and Timelapse** to `BitBang Camera` if you want timelapse video/images of your prints.
113
+
128
114
  ## Configuration
129
115
 
130
116
  All settings live in **Settings → BitBang**:
@@ -142,7 +128,7 @@ All settings take effect on OctoPrint restart. Full-screen button and brightness
142
128
  ## How it works
143
129
 
144
130
  - 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.
131
+ - 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
132
  - 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
133
 
148
134
  ## Privacy
@@ -169,41 +155,9 @@ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the f
169
155
 
170
156
  ## Installation Notes
171
157
 
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)
158
+ Skip this if [Installation](#installation) worked.
205
159
 
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.
160
+ 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
161
 
208
162
  ### Pi CSI camera not detected (falls back to USB)
209
163
 
@@ -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.4
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,58 +55,42 @@ 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)
58
+ ### Prerequisites
59
59
 
60
- In OctoPrint: **Settings Plugin Manager Get More**, search for **BitBang**, click **Install**.
60
+ These steps are outside the plugin do them first.
61
61
 
62
- ### Plugin Manager, install from URL
62
+ **Free the camera** from OctoPi's default streamer:
63
63
 
64
- **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
65
-
66
- ```
67
- https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
64
+ ```bash
65
+ sudo systemctl disable --now webcamd ffmpeg_hls camera-streamer
68
66
  ```
69
67
 
70
- Click **Install**, then restart OctoPrint when prompted.
71
-
72
- ### pip
73
-
74
- Inside your OctoPrint venv:
68
+ **32-bit Raspberry Pi OS** (`armv7l`, the standard OctoPi image) also needs `aiortc` and `pylibsrtp` rebuilt once, because its [piwheels](https://www.piwheels.org/) wheels link newer system libraries than Bookworm ships:
75
69
 
76
70
  ```bash
77
- pip install OctoPrint-BitBang
71
+ sudo apt install -y libvpx-dev libopus-dev libsrtp2-dev
72
+ ~/oprint/bin/pip install --no-binary aiortc,pylibsrtp --force-reinstall --no-deps aiortc==1.10.1 pylibsrtp==1.0.0
78
73
  ```
79
74
 
80
- Restart OctoPrint.
81
-
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).
75
+ 64-bit and x86_64 need nothing further.
83
76
 
84
- ### Did it work?
77
+ ### Install the plugin
85
78
 
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).
79
+ In OctoPrint, open **Settings Plugin Manager Get More**, choose **... from URL**, and paste:
87
80
 
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.
81
+ ```
82
+ https://github.com/richlegrand/OctoPrint-BitBang/releases/latest/download/release.zip
83
+ ```
89
84
 
90
- ## Usage
85
+ Once the plugin is accepted into OctoPrint's repository you'll also be able to find it by searching for "BitBang". Prefer the command line? `~/oprint/bin/pip install OctoPrint-BitBang` installs the same package. Either way, don't install from the GitHub source zip — it omits the bundled proxy binaries, so remote access and video won't work.
91
86
 
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.
87
+ ### Set up the camera
93
88
 
94
- Stable octopi stack:
95
- ```bash
96
- sudo systemctl stop webcamd
97
- sudo systemctl stop ffmpeg_hls
98
- sudo systemctl disable webcamd
99
- sudo systemctl disable ffmpeg_hls
100
- ```
89
+ 1. Restart OctoPrint to load the plugin — `sudo systemctl restart octoprint` (Plugin Manager offers to do this for you).
101
90
 
102
- New camera stack:
103
- ```bash
104
- sudo systemctl stop camera-streamer
105
- sudo systemctl disable camera-streamer
106
- ```
91
+ 2. Point your browser to your OctoPrint server, open the Control tab, and choose **BitBang Camera** from the webcam selector at the top-right.
107
92
 
108
- 2. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
109
- 3. Choose camera from dropdown.
93
+ 3. Open **Settings BitBang** and choose camera from dropdown.
110
94
 
111
95
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
112
96
 
@@ -114,17 +98,19 @@ sudo systemctl disable camera-streamer
114
98
 
115
99
  ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
116
100
 
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.
101
+
102
+ 5. Save and **restart OctoPrint**.
103
+
104
+ 6. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
120
105
 
121
106
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
122
107
 
123
108
  ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
124
109
 
125
-
126
110
  This URL allows remote access to your printer.
127
111
 
112
+ 7. Set `Snapshot Webcam` in **Settings → Webcam and Timelapse** to `BitBang Camera` if you want timelapse video/images of your prints.
113
+
128
114
  ## Configuration
129
115
 
130
116
  All settings live in **Settings → BitBang**:
@@ -142,7 +128,7 @@ All settings take effect on OctoPrint restart. Full-screen button and brightness
142
128
  ## How it works
143
129
 
144
130
  - 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.
131
+ - 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
132
  - 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
133
 
148
134
  ## Privacy
@@ -169,41 +155,9 @@ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the f
169
155
 
170
156
  ## Installation Notes
171
157
 
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)
158
+ Skip this if [Installation](#installation) worked.
205
159
 
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.
160
+ 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
161
 
208
162
  ### Pi CSI camera not detected (falls back to USB)
209
163
 
@@ -22,58 +22,42 @@ 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)
25
+ ### Prerequisites
26
26
 
27
- In OctoPrint: **Settings Plugin Manager Get More**, search for **BitBang**, click **Install**.
27
+ These steps are outside the plugin do them first.
28
28
 
29
- ### Plugin Manager, install from URL
29
+ **Free the camera** from OctoPi's default streamer:
30
30
 
31
- **Settings → Plugin Manager → Get More → "… from URL"**, then paste:
32
-
33
- ```
34
- https://github.com/richlegrand/OctoPrint-BitBang/archive/main.zip
31
+ ```bash
32
+ sudo systemctl disable --now webcamd ffmpeg_hls camera-streamer
35
33
  ```
36
34
 
37
- Click **Install**, then restart OctoPrint when prompted.
38
-
39
- ### pip
40
-
41
- Inside your OctoPrint venv:
35
+ **32-bit Raspberry Pi OS** (`armv7l`, the standard OctoPi image) also needs `aiortc` and `pylibsrtp` rebuilt once, because its [piwheels](https://www.piwheels.org/) wheels link newer system libraries than Bookworm ships:
42
36
 
43
37
  ```bash
44
- pip install OctoPrint-BitBang
38
+ sudo apt install -y libvpx-dev libopus-dev libsrtp2-dev
39
+ ~/oprint/bin/pip install --no-binary aiortc,pylibsrtp --force-reinstall --no-deps aiortc==1.10.1 pylibsrtp==1.0.0
45
40
  ```
46
41
 
47
- Restart OctoPrint.
48
-
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).
42
+ 64-bit and x86_64 need nothing further.
50
43
 
51
- ### Did it work?
44
+ ### Install the plugin
52
45
 
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).
46
+ In OctoPrint, open **Settings Plugin Manager Get More**, choose **... from URL**, and paste:
54
47
 
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.
48
+ ```
49
+ https://github.com/richlegrand/OctoPrint-BitBang/releases/latest/download/release.zip
50
+ ```
56
51
 
57
- ## Usage
52
+ Once the plugin is accepted into OctoPrint's repository you'll also be able to find it by searching for "BitBang". Prefer the command line? `~/oprint/bin/pip install OctoPrint-BitBang` installs the same package. Either way, don't install from the GitHub source zip — it omits the bundled proxy binaries, so remote access and video won't work.
58
53
 
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.
54
+ ### Set up the camera
60
55
 
61
- Stable octopi stack:
62
- ```bash
63
- sudo systemctl stop webcamd
64
- sudo systemctl stop ffmpeg_hls
65
- sudo systemctl disable webcamd
66
- sudo systemctl disable ffmpeg_hls
67
- ```
56
+ 1. Restart OctoPrint to load the plugin — `sudo systemctl restart octoprint` (Plugin Manager offers to do this for you).
68
57
 
69
- New camera stack:
70
- ```bash
71
- sudo systemctl stop camera-streamer
72
- sudo systemctl disable camera-streamer
73
- ```
58
+ 2. Point your browser to your OctoPrint server, open the Control tab, and choose **BitBang Camera** from the webcam selector at the top-right.
74
59
 
75
- 2. Point your browser to your local OctoPrint server. Open **Settings → BitBang**.
76
- 3. Choose camera from dropdown.
60
+ 3. Open **Settings BitBang** and choose camera from dropdown.
77
61
 
78
62
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/camera_select.png)
79
63
 
@@ -81,17 +65,19 @@ sudo systemctl disable camera-streamer
81
65
 
82
66
  ![Resolution dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/resolution_select.png)
83
67
 
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.
68
+
69
+ 5. Save and **restart OctoPrint**.
70
+
71
+ 6. Refresh the OctoPrint tab in your browser. A button labeled BitBang is available in the menu bar -- click it for the URL.
87
72
 
88
73
  ![Camera dropdown](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_select.png)
89
74
 
90
75
  ![BitBang URL](https://raw.githubusercontent.com/richlegrand/OctoPrint-BitBang/refs/heads/main/assets/bitbang_url.png)
91
76
 
92
-
93
77
  This URL allows remote access to your printer.
94
78
 
79
+ 7. Set `Snapshot Webcam` in **Settings → Webcam and Timelapse** to `BitBang Camera` if you want timelapse video/images of your prints.
80
+
95
81
  ## Configuration
96
82
 
97
83
  All settings live in **Settings → BitBang**:
@@ -109,7 +95,7 @@ All settings take effect on OctoPrint restart. Full-screen button and brightness
109
95
  ## How it works
110
96
 
111
97
  - 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.
98
+ - 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
99
  - 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
100
 
115
101
  ## Privacy
@@ -136,41 +122,9 @@ See the [BitBang project page](https://github.com/richlegrand/bitbang) for the f
136
122
 
137
123
  ## Installation Notes
138
124
 
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)
125
+ Skip this if [Installation](#installation) worked.
172
126
 
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.
127
+ 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
128
 
175
129
  ### Pi CSI camera not detected (falls back to USB)
176
130
 
@@ -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.4"
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.4"
8
8
  description = "Remote OctoPrint access with live H.264 video via BitBang WebRTC"
9
9
  readme = "README.md"
10
10
  license = "MIT"