packages/docs/docs/media-parser/media-parser-controller.mdx
:::warning We are phasing out Media Parser and are moving to Mediabunny! :::
Pass mediaParserController() to controller to steer the parseMedia() function.
Each mediaParserController can only be attached to 1 parseMedia() call.
import {mediaParserController, parseMedia} from '@remotion/media-parser';
const controller = mediaParserController();
parseMedia({
src: 'https://www.w3schools.com/html/mov_bbb.mp4',
controller,
});
// Pause
controller.pause();
// Resume
controller.resume();
// Abort
controller.abort();
This function returns an object that can be passed to parseMedia({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.
seek(timeInSeconds: number)Seeks to the best keyframe that comes before the time you specified.
getSeekingHints()Returns a promise that resolves to the seeking hints.
addEventListener()See events below.
removeEventListener()See events below.
You can attach event listeners to the object returned by mediaParserController().
import {mediaParserController, parseMedia} from '@remotion/media-parser';
const controller = mediaParserController();
const onPause = () => {
console.log('Paused');
};
const onResume = () => {
console.log('Resumed');
};
controller.addEventListener('pause', onPause);
controller.addEventListener('resume', onResume);
// Make sure to cleanup later:
controller.removeEventListener('pause', onPause);
controller.removeEventListener('resume', onResume);
It also emits the following events:
pauseEmitted when the download and parsing process is paused.
resumeEmitted when the download and parsing process is resumed.