Repository navigation
Add get_frame and get_frame_bytes for single screenshots - #61
Closed
antoniovazquezblanco wants to merge 1 commit into
Closed
antoniovazquezblanco wants to merge 1 commit into
antoniovazquezblanco wants to merge 1 commit into
Conversation
The MJPEG streams wait for frames indefinitely, so a screenshot taken without a video signal never returns. get_frame_bytes() returns one raw JPEG frame and get_frame() the decoded image; both close the stream once the frame arrives and raise TimeoutError when none arrives within `timeout` seconds (10 by default). A stream that ends before any frame raises NanoKVMInvalidResponseError.
Collaborator
|
Thanks for this, and sorry for the overlap. #65 landed One deliberate difference: I'm closing this as superseded. A few ideas from it are worth keeping, and I'll carry them over to
Thanks again for the careful tests. |
chiconws
added a commit
that referenced
this pull request
Oct 30, 2026
…ot in examples (#68) * Raise NanoKVMInvalidResponseError for empty snapshots, use get_snapshot in examples get_snapshot() raised the base NanoKVMError when the MJPEG stream ended before any frame; it now raises NanoKVMInvalidResponseError, a subclass, so existing handlers still catch it. The README and blocking-client examples save a screenshot with get_snapshot() instead of breaking out of a stream loop. Both come from #61. Co-authored-by: Antonio Vázquez Blanco <[email protected]> * Allow snapshots on the Pro with interrupt_webrtc=True get_snapshot() refused the Pro outright, because opening MJPEG there ends any WebRTC session in progress. Callers that know no session is open, or accept losing it, can now pass interrupt_webrtc=True. Without it the Pro still refuses, and the error names the flag. Measured on a Pro 1.2.15: the interrupted session raises NanoKVMVideoModeError and does not recover, while a session started after the snapshot gets video without changing the stream mode. --------- Co-authored-by: Antonio Vázquez Blanco <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MJPEG streams wait for frames indefinitely, so a screenshot taken without a video signal never returns. get_frame_bytes() returns one raw JPEG frame and get_frame() the decoded image; both close the stream once the frame arrives and raise TimeoutError when none arrives within
timeoutseconds (10 by default). A stream that ends before any frame raises NanoKVMInvalidResponseError.