Repository navigation
[mux-player-react] How to add a download button or custom control? #1197
|
Hi team, I wasn’t able to find documentation on how to add a download button using the My goal is to let users download the full video (ideally in the highest available resolution). Is this functionality supported out of the box, or would it require a custom implementation? I know MUX allows generating static MP4 assets, but I haven’t found guidance on:
Any advice, examples, or best practices would be greatly appreciated! |
Replies: 1 comment 1 reply
|
You can keep For a public playback ID, a small starting point is: import MuxPlayer from "@mux/mux-player-react";
export function Video({ playbackId, renditionName, downloadReady }) {
// renditionName comes from the ready static rendition's files[].name.
const url = `https://stream.mux.com/${playbackId}/${renditionName}?download=video`;
return (
<>
<MuxPlayer playbackId={playbackId} />
{downloadReady && <a href={url}>Download video</a>}
</>
);
}
If the button must live inside the control bar, Mux Player supports custom Media Chrome themes. The themes guide links both inline-template and custom-element examples; that lets you change the controls while retaining the player's playback/state handling. |
You can keep
MuxPlayerand add a React download link alongside it; you don't need to rebuild the player. The downloadable file is a separate static rendition, so first create ahighestrendition on the backend and wait for that rendition to be ready. The static MP4 guide documents this flow and the download URL.For a public playback ID, a small starting point is: