async def test_stream_timeout(hass, hass_client, stream_worker_sync):
    'Test hls stream timeout.'
    (await async_setup_component(hass, 'stream', {'stream': {}}))
    stream_worker_sync.pause()
    source = generate_h264_video()
    stream = preload_stream(hass, source)
    stream.add_provider('hls')
    url = request_stream(hass, source)
    http_client = (await hass_client())
    parsed_url = urlparse(url)
    playlist_response = (await http_client.get(parsed_url.path))
    assert (playlist_response.status == 200)
    future = (dt_util.utcnow() + timedelta(minutes=1))
    async_fire_time_changed(hass, future)
    playlist_response = (await http_client.get(parsed_url.path))
    assert (playlist_response.status == 200)
    stream_worker_sync.resume()
    future = (dt_util.utcnow() + timedelta(minutes=5))
    async_fire_time_changed(hass, future)
    fail_response = (await http_client.get(parsed_url.path))
    assert (fail_response.status == HTTP_NOT_FOUND)
Test hls stream timeout.
async def test_stream_timeout(hass, hass_client, stream_worker_sync):
    
    (await async_setup_component(hass, 'stream', {'stream': {}}))
    stream_worker_sync.pause()
    source = generate_h264_video()
    stream = preload_stream(hass, source)
    stream.add_provider('hls')
    url = request_stream(hass, source)
    http_client = (await hass_client())
    parsed_url = urlparse(url)
    playlist_response = (await http_client.get(parsed_url.path))
    assert (playlist_response.status == 200)
    future = (dt_util.utcnow() + timedelta(minutes=1))
    async_fire_time_changed(hass, future)
    playlist_response = (await http_client.get(parsed_url.path))
    assert (playlist_response.status == 200)
    stream_worker_sync.resume()
    future = (dt_util.utcnow() + timedelta(minutes=5))
    async_fire_time_changed(hass, future)
    fail_response = (await http_client.get(parsed_url.path))
    assert (fail_response.status == HTTP_NOT_FOUND)