in gym3/video_recorder.py [0:0]
def act(self, ac: Any) -> None:
if self._first_step:
# first action of the episode, get the existing observation before
# taking an action
self._restart_recording()
self._append_observation()
super().act(ac)
self._first_step = False
_, _, first = self.observe()
if first[self._env_index]:
self._episode_count += 1
self._first_step = True
self._writer.close()
self._writer = None
else:
self._append_observation()