mirror of https://github.com/home-assistant/core
Use content type multipart constant (#40314)
This commit is contained in:
parent
7876cdb37a
commit
c2d20c548f
|
@ -35,6 +35,7 @@ from homeassistant.components.stream.const import (
|
|||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_FILENAME,
|
||||
CONTENT_TYPE_MULTIPART,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
|
@ -184,7 +185,7 @@ async def async_get_still_stream(request, image_cb, content_type, interval):
|
|||
This method must be run in the event loop.
|
||||
"""
|
||||
response = web.StreamResponse()
|
||||
response.content_type = "multipart/x-mixed-replace; boundary=--frameboundary"
|
||||
response.content_type = CONTENT_TYPE_MULTIPART.format("--frameboundary")
|
||||
await response.prepare(request)
|
||||
|
||||
async def write_to_mjpeg_stream(img_bytes):
|
||||
|
|
|
@ -7,6 +7,7 @@ import voluptuous as vol
|
|||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONTENT_TYPE_MULTIPART,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
|
@ -122,9 +123,9 @@ class FFmpegManager:
|
|||
def ffmpeg_stream_content_type(self):
|
||||
"""Return HTTP content type for ffmpeg stream."""
|
||||
if self._major_version is not None and self._major_version > 3:
|
||||
return "multipart/x-mixed-replace;boundary=ffmpeg"
|
||||
return CONTENT_TYPE_MULTIPART.format("ffmpeg")
|
||||
|
||||
return "multipart/x-mixed-replace;boundary=ffserver"
|
||||
return CONTENT_TYPE_MULTIPART.format("ffserver")
|
||||
|
||||
|
||||
class FFmpegBase(Entity):
|
||||
|
|
Loading…
Reference in New Issue