diff --git a/rtcllm/rtc.py b/rtcllm/rtc.py index 65ab392..3b5173b 100644 --- a/rtcllm/rtc.py +++ b/rtcllm/rtc.py @@ -47,6 +47,9 @@ async def pc_get_local_candidates(pc, peer): RTCPeerConnection.get_local_candidates = pc_get_local_candidates +clas MyMediaPlayer(MediaPlayer): + pass + class RTCLLM: def __init__(self, ws_url, iceServers): # self.stt_model = WhisperModel('large-v3', device="cuda", compute_type="float16") @@ -116,14 +119,16 @@ class RTCLLM: async def auto_accept_call(self, data): opts = DictObject(iceServers=self.iceServers) pc = RTCPeerConnection(opts) + player = MyMediaPlayer('./1.mp4') llmtrack = LLMAudioStreamTrack(self.omni_infer) self.peers[data['from'].id] = DictObject(**{ 'info':data['from'], 'llmtrack':llmtrack, + 'player':player, 'pc':pc }) - llmtrack.start() - pc.addTrack(llmtrack) + pc.addTrack(MediaStreamTrack(player.audio)) + pc.addTrack(MediaStreamTrack(player.video)) await self.ws_send(json.dumps({'type':'callAccepted', 'to':data['from']})) async def pc_track(self, peerid, track):