Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix bug with video playback #445

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions expyfun/visual/_visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,12 +1406,17 @@ def _draw(self):

def draw(self):
"""Draw the video texture to the screen buffer."""
self._player.update_texture()
# detect end-of-stream to prevent pyglet from hanging:
if not self._eos:
if self._visible:
done = False
if self._player.source is None:
done = True
if not done:
self._player.update_texture()
# detect end-of-stream to prevent pyglet from hanging:
if self._eos:
done = True
elif self._visible:
self._draw()
else:
if done:
self._finished = True
self.pause()
self._ec.check_force_quit()
Expand Down Expand Up @@ -1448,9 +1453,10 @@ def _eos_old(self):
)

def _eos_new(self):
done = self._player.source is None
ts = self._source.get_next_video_timestamp()
dur = self._source._duration
return ts is None or ts >= dur
return done or ts is None or ts >= dur

@property
def playing(self):
Expand Down
Loading