I have created .Net Core API + React Project and trying to stream a video file from Azure Blob Storage like the following code. The API code is working fine, but when I play the video file, I am not able to forward or backward the video timings.
my C# API code,
[AllowAnonymous]
[HttpGet("writetostreamfromblob")]
public async Task<FileContentResult> WriteToStreamFromBlob(string filename)
{
try
{
return await _documentsService.FielStreamFromBlob() ;
}
catch (Exception ex)
{
throw ex;
}
}
My DocumentService method,
public async Task<FileContentResult> FielStreamFromBlob()
{
try
{
var cloudBlob = await _blobService.GetBlobAsync(PlatformServiceConstants._blobIntroductoryVideoContainerPath + PlatformServiceConstants.IntroductoryVideo1, introductoryvideocontainerName);
var fileStream = new MemoryStream();
MemoryStream memStream = new MemoryStream();
await cloudBlob.DownloadToStreamAsync(memStream);
return new FileContentResult (memStream.ToArray(), "application/octet-stream");
}
catch (Exception e)
{
throw e;
}
}
And my React or HTML code to render the file content,
<div className="content__area__container" style={{width:'50%',float:'right',marginTop:'100px'}}>
<video height="auto" controls style={{ width: '100%' }}>
<source src="documents/writetostreamfromblob?filename=Beach" type="video/mp4" />
</video>
</div>
The video playing without any error but not able to start or forward the video, Where did I go wrong?. Is this a proper approach in .Net Core?