The page loads slowly even though I'm retrieving a video stream from AWS CloudFront using Next.js and getServerSideProps.
export const getServerSideProps = withPageAuthRequired({
async getServerSideProps(context) {
try {
// ... fetch access token and meeting details ...
const videoSrc = await fetch(`https://cloudfrontURLHere.cloudfront.net/${meeting.meeting_video}`, requestOptions);
const buffer = await videoSrc.buffer();
return {
props: {
video: buffer.toString('base64'),
},
};
} catch (error) {
console.error(error);
return {
props: {},
};
}
},
ssr: false,
});
This code functions, but loading the video takes a while, especially for larger files. Is there a more effective approach for Next.js to fetch video streams via CloudFront that also includes authorization?
Thanks.