Skip to content

Commit

Permalink
feat: check if stream is alive
Browse files Browse the repository at this point in the history
  • Loading branch information
fuatakgun committed Nov 29, 2023
1 parent ff23d2e commit 6a7aa03
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions custom_components/eufy_security/eufy_security_api/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,18 @@ async def _initiate_start_stream(self, stream_type) -> bool:
return False

async def check_live_stream(self):
if self.p2p_streamer.retry is not None:
_LOGGER.debug(f"async_restart_livestream - start - {self.p2p_streamer.retry}")
if self.stream_status != StreamStatus.IDLE:
await self.stop_livestream()
if self.p2p_streamer.retry is True:
_LOGGER.debug(f"async_restart_livestream - sleep - {self.p2p_streamer.retry}")
await asyncio.sleep(1)
_LOGGER.debug(f"async_restart_livestream - start live stream finish - {self.p2p_streamer.retry}")
await self.start_livestream()
_LOGGER.debug(f"async_restart_livestream - start live stream end - {self.p2p_streamer.retry}")
while self.p2p_streamer.retry is None:
await asyncio.sleep(1)

_LOGGER.debug(f"async_restart_livestream - start - {self.p2p_streamer.retry}")
if self.stream_status != StreamStatus.IDLE:
await self.stop_livestream()
if self.p2p_streamer.retry is True:
_LOGGER.debug(f"async_restart_livestream - sleep - {self.p2p_streamer.retry}")
await asyncio.sleep(1)
_LOGGER.debug(f"async_restart_livestream - start live stream finish - {self.p2p_streamer.retry}")
await self.start_livestream()
_LOGGER.debug(f"async_restart_livestream - start live stream end - {self.p2p_streamer.retry}")

async def start_livestream(self) -> bool:
"""Process start p2p livestream call"""
Expand Down

0 comments on commit 6a7aa03

Please sign in to comment.