The flush() method of the VideoEncoder interface forces all pending encodes to complete.
flush()
MDN Reference