How to stream video from dot net core 3 api using s3 bucket?

Viewed 296

Currently, I have the following implementation to stream a video saved locally. I guess a key part of this is the range processing so that the entire video is not loaded when an API call is made.

    [HttpGet]
    [Route("StreamVideo/{AttachmentID}")]
    public FileResult StreamVideo(string attachmentID)
    {
        try
        {
         
            return PhysicalFile(Path.Combine("somelocation",attachmentID), "application/octet-stream", enableRangeProcessing: true);
        }
        catch (Exception ex)
        {

            _logger.LogError(ex,"Error while getting video content ");
            throw new Exception("Unable to load video content");
        }
    }

The above works great. However, how do I get the same functionality from a video saved on an s3 bucket? I already have s3 integration setup in my api so I can read and write to my s3 storage making use of the awssdk. I know just need to know how to use this SDK to get similar functionality, please help!

0 Answers
Related