add option to set content_type in camera.generic to support 'svg cameras'#8188
Conversation
|
That need unittests... |
|
@pvizeli, I'll look to that. I wasn't sure about this approach to get svg cameras running, do you approve? (I thought also of a new camera platform for svg files as direct approach) |
|
@pvizeli, I'm thinking that this new option to set the |
|
This won't work as when we're streaming, we're converting the jpeg files to mjpeg. |
|
Hi @balloob, I'm sorry to disagree with you, but in the generation of the video stream no conversion is performed, but frames are added sequentially, separated with an identifier. Each frame has its mime type, which is currently set to 'image/jpeg' (although it works for cameras that return a PNG image!, I think the browser renders them in spite of the error) Before proposing the PR, this change I tested in iOS Safari, Safari, Firefox and Chrome for Mac, and works perfectly for both the still image and the video stream. When making me doubt, I even made a mini component derived from the I hope you reconsider the statement that it won't work. |
|
I must admit that I didn't believe you but tested it locally and it works 👍 . Learned something new today. |
|
Thank you very much for reconsider, @balloob! I'm no video expert, but when I have the time I like to explore and try. I myself had this problem of SVG cameras at the beginning of using Home Assistant, and I solved it by converting the SVGs into PNGs on the origin server in order to be able to display some plots in HA from a custom component I have for a current meter. Now I will use this direct approach. So, what do you think about the |
|
Guessing is the way to go: example code |
|
Going to merge this, you can open another PR for local file. |
…ras' (home-assistant#8188) * add custom content_type to support 'generic svg cameras' * add unittest to check content_type for svg generic camera * Tweak tests
Description:
Add customisable content_type to the
genericcamera to be able to get snapshots and stream a dynamic svg file.Related issue (if applicable): fixes #8162
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#2887
Example entry for
configuration.yaml(if applicable):Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code does not interact with devices:
toxrun successfully. Your PR cannot be merged unless tests pass