webcodecsController()
Pass webcodecsController()
to controller
to steer the convertMedia()
function.
Use webcodecsController()tsx
import {webcodecsController ,convertMedia } from '@remotion/webcodecs';constcontroller =webcodecsController ();convertMedia ({src : 'https://www.w3schools.com/html/mov_bbb.mp4',container : 'webm',controller ,});// Pausecontroller .pause ();// Resumecontroller .resume ();// Abortcontroller .abort ();
API
This function returns an object that can be passed to convertMedia({controller})
.
It has the following methods:
pause()
Pauses the conversion.
resume()
Resumes the conversion.
abort()
Aborts the conversion.
addEventListener()
See events below.
removeEventListener()
See events below.
Events
You can attach event listeners to the webcodecsController
object.
Use eventstsx
import {webcodecsController ,convertMedia } from '@remotion/webcodecs';constcontroller =webcodecsController ();constonPause = () => {console .log ('Paused');};constonResume = () => {console .log ('Resumed');};controller .addEventListener ('pause',onPause );controller .addEventListener ('resume',onResume );// Make sure to cleanup later:controller .removeEventListener ('pause',onPause );controller .removeEventListener ('resume',onResume );
The webcodecsController
object emits the following events:
pause
Emitted when the conversion is paused.
resume
Emitted when the conversion is resumed.