mediaParserController()
Pass mediaParserController()
to controller
to steer the parseMedia()
function.
Use mediaParserController()tsx
import {mediaParserController ,parseMedia } from '@remotion/media-parser';constcontroller =mediaParserController ();parseMedia ({src : 'https://www.w3schools.com/html/mov_bbb.mp4',controller ,});// Pausecontroller .pause ();// Resumecontroller .resume ();// Abortcontroller .abort ();
API
This function returns an object that can be passed to parseMedia({controller})
and downloadAndParseMedia({controller})
.
It has the following methods:
pause()
Pauses the download and parsing process.
resume()
Resumes the download and parsing process.
abort()
Aborts the download and parsing process.
addEventListener()
See events below.
removeEventListener()
See events below.
Events
You can attach event listeners to the mediaParserController
object.
Use eventstsx
import {mediaParserController ,parseMedia } from '@remotion/media-parser';constcontroller =mediaParserController ();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 mediaParserController
object emits the following events:
pause
Emitted when the download and parsing process is paused.
resume
Emitted when the download and parsing process is resumed.