Which method of using a bearer token to stream video from AWS CloudFront in Next.js is the most effective?

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) {
      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?


did not see a question about rclone?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.