From 4a4bb434220c15c1a2cf31e47b73b90146f82ffa Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 12 Mar 2019 11:46:20 -0700 Subject: [PATCH] Stream: Only add base url when needed (#21979) --- homeassistant/components/camera/__init__.py | 2 +- homeassistant/components/stream/__init__.py | 2 +- homeassistant/components/stream/hls.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index 48dd355ebd6..95d6dba50c3 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -566,7 +566,7 @@ async def async_handle_play_stream_service(camera, service_call): url = request_stream(hass, camera.stream_source, fmt=fmt) data = { ATTR_ENTITY_ID: entity_ids, - ATTR_MEDIA_CONTENT_ID: url, + ATTR_MEDIA_CONTENT_ID: "{}{}".format(hass.config.api.base_url, url), ATTR_MEDIA_CONTENT_TYPE: FORMAT_CONTENT_TYPE[fmt] } diff --git a/homeassistant/components/stream/__init__.py b/homeassistant/components/stream/__init__.py index 5a4b1ade96d..1d04791a11a 100644 --- a/homeassistant/components/stream/__init__.py +++ b/homeassistant/components/stream/__init__.py @@ -59,7 +59,7 @@ def request_stream(hass, stream_source, *, fmt='hls', stream.access_token = generate_secret() stream.start() return hass.data[DOMAIN][ATTR_ENDPOINTS][fmt].format( - hass.config.api.base_url, stream.access_token) + stream.access_token) except Exception: raise HomeAssistantError('Unable to get stream') diff --git a/homeassistant/components/stream/hls.py b/homeassistant/components/stream/hls.py index 285f752c033..8f5dd6c1884 100644 --- a/homeassistant/components/stream/hls.py +++ b/homeassistant/components/stream/hls.py @@ -18,7 +18,7 @@ def async_setup_hls(hass): """Set up api endpoints.""" hass.http.register_view(HlsPlaylistView()) hass.http.register_view(HlsSegmentView()) - return '{}/api/hls/{}/playlist.m3u8' + return '/api/hls/{}/playlist.m3u8' class HlsPlaylistView(StreamView):