bugfix
This commit is contained in:
parent
14cd252502
commit
a05a99c534
@ -7,6 +7,7 @@ class MyMediaPlayer(MediaPlayer):
|
|||||||
|
|
||||||
class MyTrackBasea:
|
class MyTrackBasea:
|
||||||
def __init__(self, source=None):
|
def __init__(self, source=None):
|
||||||
|
self.reloaded = False
|
||||||
self.source = source
|
self.source = source
|
||||||
self.track = self.set_track()
|
self.track = self.set_track()
|
||||||
self.track.on('ended', self.reload)
|
self.track.on('ended', self.reload)
|
||||||
@ -17,9 +18,10 @@ class MyTrackBasea:
|
|||||||
else:
|
else:
|
||||||
self.track = self.source.video
|
self.track = self.source.video
|
||||||
|
|
||||||
def self.reload(self):
|
def reload(self):
|
||||||
print(f'reload the source----{self.source._file_path}')
|
print(f'reload the source----{self.source._file_path}')
|
||||||
self.set_source(MyMediaPlayer(self.source._file_path))
|
self.set_source(MyMediaPlayer(self.source._file_path))
|
||||||
|
self.reloaded = True
|
||||||
|
|
||||||
def set_source(self, source):
|
def set_source(self, source):
|
||||||
self.source = source
|
self.source = source
|
||||||
@ -29,10 +31,10 @@ class MyTrackBasea:
|
|||||||
if self.source is None:
|
if self.source is None:
|
||||||
return None
|
return None
|
||||||
f = await self.source.audio.recv()
|
f = await self.source.audio.recv()
|
||||||
while f is None:
|
while self.reloaded:
|
||||||
print('MyAudioTrack::recv(): will reload source')
|
print('MyAudioTrack::recv(): will reload source')
|
||||||
self.set_source(MyMediaPlayer(self.source._file_path))
|
|
||||||
f = await self.source.audio.recv()
|
f = await self.source.audio.recv()
|
||||||
|
self.reloaded = False
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user