Home > OS >  Html video won't autoplay on ios with playsinline
Html video won't autoplay on ios with playsinline

Time:07-12

I have an html video that I'm trying to render on ios but the video won't autoplay. I found similar questions mentioning to use "playsinline" but I tried this approach and it doesn't fix the issue in my case. Here is how I'm currently displaying the video in Html:

        <video  playsinline autoplay muted>
            <source src="https://192.168.1.134:7278/GetVideo" type="video/mp4;" />
        </video>

This gets streamed from some C# .NET Core code:

            FileStream fileStream = new FileStream(path, FileMode.Open);
            var result = new FileStreamResult(fileStream, contentType)
            {
                EnableRangeProcessing = true
            };
            return result;

This approach works great in chrome but on ios its getting this issue where it won't autoplay. If I add "controls" to the video in html then the play button will appear on ios and I can press play and the video will start playing. However, I'm looking to get the video to autoplay and without the video controls.

CodePudding user response:

So, I'm not exactly sure why but, Changing my html to this (with the src specified directly in the video html rather than in a sub "source" html class) fixed the issue:

<video  src="https://192.168.1.134:7278/GetVideo" playsinline loop muted autoplay></video>
  • Related