packages/docs/docs/media-fragments.mdx
Remotion by default adds Media fragment hashes to video URLs.
For example, the following Remotion code:
import {Sequence, OffthreadVideo, useVideoConfig} from 'remotion';
export const MyComp: React.FC = () => {
const {fps} = useVideoConfig();
return (
<Sequence from={2 * fps} durationInFrames={4 * fps}>
<OffthreadVideo src="https://example.com/bbb.mp4" />
</Sequence>
);
};
results in the following <video> tag being mounted:
<video src="https://example.com/bbb.mp4#t=2.0,4.0" />
This instructs browsers to only load the section of 00:02 to 00:04 of the video.
It improves playback performance and reduces bandwidth usage.
On Safari, these hints have higher importance. We find that without these hints, Safari videos behave badly on mobile.
You can disable Remotion appending media fragments by appending your own hash:
import {Sequence, OffthreadVideo, useVideoConfig} from 'remotion';
export const MyComp: React.FC = () => {
const {fps} = useVideoConfig();
return (
<Sequence from={2 * fps} durationInFrames={4 * fps}>
<OffthreadVideo src="https://example.com/bbb.mp4#disable" />
</Sequence>
);
};
If your <Sequence>'s change value over time, the media fragments will change too.
Anytime they change, the browser considers this a new source and re-loads the video.
There are valid scenarios where we recommend disabling the media fragment hints:
from and durationInFrames values of a <Sequence> dynamicallytrimBefore and trimAfter values of a <Html5Video> or <OffthreadVideo> dynamicallyplaybackRate of a <Html5Video>, <OffthreadVideo> or <Video> over time.Normally you would not do this, but there are exceptions, like: Changing the speed of a video over time
Use the automatic media fragment hints as a default because they are helpful with playback performance.
If you find a valid scenario where you need to disable the media fragment hints, you can do so.
If the playback performance suffers, you can also provide your own media fragment hint to the URL.