15 lines
424 B
Python
15 lines
424 B
Python
# app/services/stream_manager.py
|
|
import time
|
|
stream_manager = {}
|
|
|
|
def reset_stream_time(stream_id: str):
|
|
if stream_id in stream_manager:
|
|
stream_manager[stream_id]["create_time"] = int(time.time() * 1000)
|
|
|
|
def stop_stream(stream_id: str):
|
|
stream = stream_manager.pop(stream_id, None)
|
|
if stream:
|
|
process = stream["process"]
|
|
process.terminate()
|
|
print(f"Stream {stream_id} stopped.")
|