I am trying to get a video to play in an HTML5 tag using the following code:
<video id="video" width="768" height="432" controls> <source src="http://example.com/videos/example.mp4" type="video/mp4" /> </video>
This initially did not work, and I tracked it to the point that the issue with basic authentication is included in the domain. However, if I try to retype it in the .htaccess file as follows:
AuthUserFile /folder/containing/.htpasswd AuthType Basic AuthName "Members Area" Require valid-user
The video player simply stops on the "Loading ..." screen. Also, if I try to access the file directly, playback in the browser will return to using the quicktime controls, rather than the HTML5 controls that you get when authentication is disabled.
Currently, the only solution I have is to remove / eliminate the need for authentication in the folder containing the movie files for the site. However, I prefer that authentication be enabled throughout the domain.
Therefore, I am wondering if there is a way to serve video content that is behind basic authentication.
Note. I'm currently working on making this work in Safari and therefore focus on mp4 format.
source share