From 35de168787d225dae12b56f5bb408943f95bb397 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 11 Sep 2024 13:20:58 +0800 Subject: [PATCH] bugfix --- rtcllm/aav.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/rtcllm/aav.py b/rtcllm/aav.py index 64b3845..d0f623a 100644 --- a/rtcllm/aav.py +++ b/rtcllm/aav.py @@ -8,33 +8,30 @@ class MyMediaPlayer(MediaPlayer): class MyTrackBase(MediaStreamTrack): def __init__(self, source=None): super().__init__() - self.reloaded = False self.source = source - self.set_track() + self.set_source_track() print(f'{self.kind=}, {self.__class__.__name__}') - def set_track(self): + def set_source_track(self): if self.kind == 'audio': self.track = self.source.audio else: self.track = self.source.video - self.track.on('ended', self.reload) - def reload(self): + def source_reload(self): print(f'reload the source----{self.source._file_path}') self.set_source(MyMediaPlayer(self.source._file_path)) - self.reloaded = True def set_source(self, source): self.source = source - self.set_track() + self.set_source_track() async def recv(self): print(f'{self.__class__.__name__}, {self.source.duration=}, {self.source.time=}') if self.source is None: return None if self.track.readyState != 'live': - self.reload() + self.source_reload() f = await self.track.recv() return f