This commit is contained in:
yumoqing 2024-09-11 13:01:41 +08:00
parent 183725e0bb
commit 95947c5fb8

View File

@ -5,8 +5,9 @@ from aiortc import VideoStreamTrack, AudioStreamTrack
class MyMediaPlayer(MediaPlayer): class MyMediaPlayer(MediaPlayer):
pass pass
class MyTrackBase: class MyTrackBase(MediaStreamTrack):
def __init__(self, source=None): def __init__(self, source=None):
super().__init__()
self.reloaded = False self.reloaded = False
self.source = source self.source = source
self.set_track() self.set_track()
@ -38,12 +39,8 @@ class MyTrackBase:
return f return f
class MyAudioStreamTrack(AudioStreamTrack, MyTrackBase): class MyAudioStreamTrack(MyTrackBase):
def __init__(self, source=None): kind = 'audio'
AudioStreamTrack.__init__(self)
MyTrackBase.__init__(self, source=source)
class MyVideoStreamTrack(VideoStreamTrack, MyTrackBase): class MyVideoStreamTrack(VideoStreamTrack, MyTrackBase):
def __init__(self, source=None): kind = 'video'
VideoStreamTrack.__init__(self)
MyTrackBase.__init__(self, source=source)