Back to Remotion

hasBeenAborted()

packages/docs/docs/media-parser/has-been-aborted.mdx

4.0.471917 B
Original Source

:::warning We are phasing out Media Parser and are moving to Mediabunny! :::

Pass an error to the hasBeenAborted() function to check if the error was thrown because you opted to abort the render.
In this case, the error is intentional and you probably don't want to display it.

Check if a media file download has been aborted.

tsx
import {parseMedia, hasBeenAborted} from '@remotion/media-parser';

try {
  await parseMedia({
    src: 'https://www.w3schools.com/html/mov_bbb.mp4',
  });
} catch (e) {
  if (hasBeenAborted(e)) {
    console.log('Has been aborted by user / developer');
  } else {
    console.error('Download failed', e);
  }
}

See also