MediaRecorder

A MediaRecorder allows you to record any stream object, e.g. from:

In [1]:
from ipywebrtc import VideoStream, MediaRecorder
In [2]:
video = VideoStream.from_url('./ipyvolume.mp4')
video
In [3]:
recorder = MediaRecorder(stream=video)
recorder

Use ‘record’ and ‘play’ button for recording and checking. Programatical control is available using the MediaRecorder.record trait, and the MediaRecorder.play method.

In [ ]:
recorder.record = True
In [ ]:
recorder.record = False
In [ ]:
recorder.play()

Saving can be done by clicking the download button, or programmatically using the save method. If autosave is True, the recording will be saved directly to disk.

In [ ]:
recorder.save('example.mp4')
In [ ]:
example = VideoStream.from_file('example.mp4')
example