diff --git a/manim_slides/present/player.py b/manim_slides/present/player.py index 150b4d08..3db153ad 100644 --- a/manim_slides/present/player.py +++ b/manim_slides/present/player.py @@ -4,7 +4,7 @@ from qtpy.QtCore import Qt, QTimer, QUrl, Signal, Slot from qtpy.QtGui import QCloseEvent, QIcon, QKeyEvent, QScreen -from qtpy.QtMultimedia import QAudioOutput, QMediaPlayer +from qtpy.QtMultimedia import QAudioOutput, QMediaPlayer, QVideoFrame from qtpy.QtMultimediaWidgets import QVideoWidget from qtpy.QtWidgets import ( QHBoxLayout, @@ -240,6 +240,18 @@ def __init__( self.presentation_changed.connect(self.presentation_changed_callback) self.slide_changed.connect(self.slide_changed_callback) + old_frame = None + + def frame_changed(frame: QVideoFrame) -> None: + nonlocal old_frame + + if old_frame and (frame.size() != old_frame.size()): + self.video_sink.setVideoFrame(old_frame) + frame = old_frame + + self.info.video_sink.setVideoFrame(frame) + old_frame = frame + self.info = Info( full_screen=full_screen, aspect_ratio_mode=aspect_ratio_mode, @@ -248,7 +260,7 @@ def __init__( self.info.close_event.connect(self.closeEvent) self.info.key_press_event.connect(self.keyPressEvent) self.video_sink.videoFrameChanged.connect( - lambda frame: self.info.video_sink.setVideoFrame(frame) + frame_changed ) self.hide_info_window = hide_info_window diff --git a/pyproject.toml b/pyproject.toml index ae0ad5be..11ccbe15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ manim = ["manim>=0.18.0"] manimgl = ["manimgl>=1.6.1;python_version<'3.12'"] pyqt6 = ["pyqt6>=6.6.1"] pyqt6-full = ["manim-slides[full,pyqt6]"] -pyside6 = ["pyside6>=6.5.1,<6.5.3;python_version<'3.12'", "pyside6>=6.6.1;python_version>='3.12'"] +pyside6 = ["pyside6>=6.6.1"] pyside6-full = ["manim-slides[full,pyside6]"] sphinx-directive = ["docutils>=0.20.1", "manim-slides[manim]"] tests = [