0

Controller

   public IActionResult play(IFormFile video1)
    {
            //read decrypted in bytes
            MemoryStream ms = new MemoryStream();
            video1.CopyTo(ms);
            var readVideoBytes = ms.ToArray();

            //encrypt
            var decryptedVideoBytes = DecryptionAes(readVideoBytes);
            var fileBytes1 = decryptedVideoBytes.ToArray();

             ViewBag.Data = Convert.ToBase64String(fileBytes1);
     }

View

  <form asp-controller="video" asp-action="index" method="post" enctype="multipart/form-data" id="editForm">
  <input type="file" name="video1" id="video1" class="form-control browse-btn mb-2">
   <input type="submit" value="View Video" />
 </form>

  @if (ViewBag.Data != null)
  {         
    <video controls autoplayheight="300" width="300">    
        <source type="video/mp4" src="data:video/mp4;base64,@ViewBag.Data">       
    </video>
   }

Image UI

enter image description here

Above Worked well for small video but for larger video it is not working

How to create byte array in chunk and play ?

User
  • 1,334
  • 5
  • 29
  • 61
  • It may be caused by the upload failure because the file is too large, can you rule out this reason? – Xinran Shen Feb 08 '23 at 07:42
  • @XinranShen yes so that reason i want pass file in chunk or any other solution – User Feb 08 '23 at 08:45
  • 1
    You can refer to this [issue](https://stackoverflow.com/questions/62502286/uploading-and-downloading-large-files-in-asp-net-core-3-1). – Xinran Shen Feb 08 '23 at 08:50

0 Answers0