Camen Design Forum

.htaccess --- where is it and how is it important when trying to look at videos?

append delete virsto

I am rather familiar with HTML; but, very new to playing (viewing) videos in an HTML document. When testing my HTML code (e.g. what has been posted at ), I use FireFox 25 to display it. This works fine for nearly everything I have written in HTML; but, I have yet to succeed in playing any video in FireFox --- no matter what I put in my HTML code. And yes I have read what is posted at many Web locations that address video related problems in HTML documents. It could be related to the parameters that one must set (e.g. .htaccess); but, where and how do I set these parameters? I would be glad to provide any additional information that might be useful for the solution of how to play videos in an HTML document. Note, I have tried this on both Windows Vista (32-bit) and Windows 7 (64-bit) platforms.

:: @virsto added on 27 Nov ’13 · 16:14

I should add that my application is as follows. I create an HTML file that contains code to play a video. This file (along with the video) is sent to someone else. I would like for the person to be able view this HTML and video in FireFox 22+, IE 9+ on their Windows Vista+ system. That is, it is a sort-of tutorial in HTML that contains embedded videos. So far, I have been unable to get it play a video on any of my PCs during development.

Reply RSS


append delete #1. Martijn

.htaccess files will not help you in your scenario. They are instruction files for web servers, mainly Apache. So if you are talking about simply sending the HTML and video file to be loaded locally on a computer – without every recipient running a local webserver – .htaccess is out of the question.

append delete #2. TCB

Like Martijn says, this is not a problem with .htaccess. Enabling the proper mime types using .htaccess would only be necessary on a server, not with locally stored files like you're using. Most likely, there's simply a bug in your code. I have no trouble runnning HTML5 video on a local machine like you're trying to do.

Check your code and make sure there are no mistakes. I find it very easy to mess up some little thing using VfE, and hardly ever get it right the first time.

The first possible problem that comes to mind is that you need to either use an absolute address pointing to the video files on a remote server or have all of the files bundled together in a folder and use relative addresses.

Are the files actually there in the place you're referring to?
Since you can't play video on any of your machines, this seems like a very likely scenario: your references are wrong in some way.

The following code works when run locally. You can use it as a template, substituting references to your own movie files as a place to start. *Make sure your movie files are in the same folder as the html file.*

There are issues with running flash content locally, so I left the flash fallback out. But this should work in any modern browser. Let me know if this is any help.

<h1>How To Do It</h1>

<p style="font-size:10px;">
<video controls="controls" poster="MyMovie.jpg" width="320" height="240">
	<source src="MyMovie.mp4" type="video/mp4" />
	<source src="MyMovie.webm" type="video/webm" />
	<source src="MyMovie.ogv" type="video/ogg" />

	<br/><strong>Download video:</strong> <a href="MyMovie.mp4">MP4</a> | <a href="MyMovie.ogv">Ogg</a> | <a href="MyMovie.webm">WebM</a>

<p>These are my instructions written out in text, but just watch the movie.  You'll get it.</p>
append delete #3. webanalyst

what is difference between the http and https?

append delete #4. Ben

This doesn't really belong in this thread. However, here goes:

HTTPS adds a level of security to standard HTTP by using a security protocol (SSL/TLS). The way the security works is that when you try to access a website via HTTPS the website will send you a certificate that can be checked via a trusted authority (VeriSign, Microsoft, etc) and your computer and the server agree on a cryptographic key that will be used to encrypt anything sent across the wires.

This serves a few purposes. Firstly, anyone intercepting your messages won't be able to see what you sent and what you received unless they can break the key. Secondly, anyone intercepting your messages won't be able to insert their own content into the middle (called a man-in-the-middle attack). The certificates also mean that you can be confident that the website actually is the site they say they are.

This is critical in applications handling sensitive information - you would be negligent not to send credit card information through HTTPS, for example.

However, it's not a perfect system. It depends on trusted authorities confirming the certificates, and it also doesn't stop a snooper from knowing what websites are visited.

It's also easy to slip up. If your website uses HTTPS for your login but nowhere else, then despite the fact that a snooper won't be able to read users' passwords, they would still be able to access session data when HTTP pages are visited.

In short, HTTPS gives a level of protection that HTTP doesn't through certification and encryption. It's not going to stop every type of malicious attack, but it does help. If a website is able to offer it, then they probably should.

append delete #5. webanalyst


thanks for replay ben,
How to change the .htaccess?

append delete #6. Ben

You'll need to be more specific.

To change the .htaccess file, open it in your regular code editor, change it, then save those changes. It's just a text file.

If you have a specific question regarding specific changes, then I'd need to know what they are before I can offer advice.

Please open a new thread. You do not seem to be asking questions regarding serving videos, which is what this thread is about.


(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn