0

I'm trying to play an mp4 file from a URL in Amazon S3 from my code:

// Navigate to a URL.
Process.Start(new ProcessStartInfo(cmeo.text) { UseShellExecute = true });

'cmeo.text' contains the url of the mp4 file. Most times, the code starts my default browser (in my case, Vivaldi) and plays the video within the browser. This is the desired behavior. However, On occasion, rather than playing the video, the browser asks me to download it first. I haven't been able to figure out why there is a discrepancy.

rrirower
  • 4,338
  • 4
  • 27
  • 45
  • How the browser handles files depends on the Content-Type header returned in the response, how that content type is configured to be handled on the system, and maybe more. It's possible that certain videos are being returned (in the Amazon S3 response) with the wrong content type, and even if the content type is right, you're subject to the browser's handling, which can vary from client to client. If you provide runtime information about what content types are being returned, we might be able to help you deal with that issue, but the other is out of your hands. – madreflection Jun 24 '22 at 20:16
  • By "running" the URL, i.e. using the shell to open it using its registered association, you're yielding a lot of control over what takes place. It's plausible that .mp4 files are registered to be opened in a video editor on someone's system. You have no control over that. – madreflection Jun 24 '22 at 20:19
  • This may happen because the video file has an extension that doesn't match the format, e.g., an `.avi` video with the extension renamed to `.mp4` (or the other way around). In this case, the Browser should ask you to download it. – Jimi Jun 24 '22 at 21:00
  • Thanks for the feedback. Given the uncertainty of using the browser, I've decided to redesign the code to use a VLC view in a form. – rrirower Jun 27 '22 at 17:42

0 Answers0