I am trying to stream video and audio files to the video.js player on my site from Digital Ocean Spaces, which is similar to Amazon AWS S3 and uses the aws-sdk. Currently the video takes a while to download and then when the download completes, it plays. I would like to have it download in chunks and begin playing the first chunk as soon as it completes. How can I achieve this? Here is my existing player code:
<html>
<head>
<link href="//unpkg.com/video.js/dist/video-js.min.css" rel="stylesheet">
<script src="//unpkg.com/video.js/dist/video.min.js"></script>
</head>
<body>
<div >
<video
id="my-player"
class="video-js"
controls
preload="auto"
data-setup='{}'
width=640 height=auto
>
<source src = "[VIDEO SOURCE URL]" type = "video/mp4">
</video>
</div>
</body>
</html>
I found the solution was to generate a presigned url, then use that for embedding into the html5 video/audio players. The DigitalOcean Api provided some excellent examples: https://docs.digitalocean.com/products/spaces/resources/s3-sdk-examples/#presigned-url