self.pipe.set_state(Gst.State.NULL)
-async def run_repeated(task):
- while True:
- await task()
- await asyncio.sleep(0.1)
-
-
async def run(laplace_uri: str, rtmp_uri: str):
try:
events = Events()
print(e)
+async def run_repeated(laplace_uri: str, rtmp_uri: str, sleep_time: float):
+ while True:
+ await run(laplace_uri, rtmp_uri)
+ await asyncio.sleep(sleep_time)
+
+
def main():
logging.basicConfig(level=logging.DEBUG, format='%(asctime)-15s %(message)s')
default_source = 'wss://localhost:1234/ws_connect?id=cug'
help=f'Laplace signalling websocket URI, default: {default_source}')
parser.add_argument('-d', '--destination', default=default_dest,
help=f'RTMP server URI, default: {default_dest}')
+ parser.add_argument('-r', '--retry', action='store_true', help=f'Retry forever if room not found or closed')
args = parser.parse_args()
Gst.init(None)
- asyncio.run(run(args.source, args.destination))
+ if args.retry:
+ job = run_repeated(args.source, args.destination, 2.)
+ else:
+ job = run(args.source, args.destination)
+ asyncio.run(job)
if __name__ == '__main__':