Question

How to access the webdav folder from html (video streaming)

Posted January 23, 2021 789 views
Apache

I have set up a webdav folder using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-configure-webdav-access-with-apache-on-ubuntu-14-04

To confuse issues I have multiple sites on the server. I am able to record a live stream to the files webdav folder, located at /var/www/webdav. But I am unable to access it within the HTML using video.js, and with a video js plugin that supports HLS.

My script files are:

<script src="js/video.js"></script>
<script src="js/videojs-http-streaming.min.js"></script>
<script>
var player = videojs('vid1');
player.play();
</script>

My html:

<video-js id=vid1 width=600 height=300 class="vjs-default-skin" controls>
  <source
     src="htttp://IPADRESS/webdav.m3u8"
     type="application/x-mpegURL">
</video-js> 

I am getting an error which says:

ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded,
either because the server or network failed or because the format is not supported. 

I have tried multiple ways of adding:

Header set Access-Control-Allow-Origin "example.com"

And nothing is working. After many hours of struggling to get a live stream working, I would be extremely grateful for some ideas of what I can do.

edited by bobbyiliev

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there @calid,

Are you able to access the htttp://IPADRESS/webdav.m3u8 video directly if you visit it via your browser?

If not, what I could suggest is using a subdomain name and creating a new separate virtual host that maps to the /var/www/webdav folder so that then you could use the subdomain name in your JavaScript file.

Let me know how it goes.
Regards,
Bobby