Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 Video not playing in Safari on Localhost

Tags:

safari

I have tested the video, an mp4 file created using Handbreak, on Safari by opening the file directly. Yet when it runs through localhost the file just shows a play arrow with no content.

This is true for both desktop and mobile Safari, yet Firefox and Chrome appear to work fine.

Here's my code:

    <video muted poster="/images/post.jpg" playsinline>
        <source src="/video.mp4" type="video/mp4">
    </video>
like image 550
Shane Hudson Avatar asked Oct 30 '25 00:10

Shane Hudson


1 Answers

Answering my own question, it turns out that this is a shortcoming of python -m "SimpleHTTPServer" that I was using to run the localhost server. So it seems Safari requires functionality that SimpleHTTPServer does not provide.

Thankfully, I was able to successfully use Node's version http-server which does appear to have the functionality Safari required.

like image 127
Shane Hudson Avatar answered Nov 01 '25 14:11

Shane Hudson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!