views:

11

answers:

1

Accessing following html directly from file system gives me the correct duration.

<video src="multimedia/bbb400p.ogv" id="v"></video> 
<button onclick="alert(document.getElementById('v').duration);
                 document.getElementById('v').play()">Play</button>

However, accessing it through mongrel web server (on my machine and through heroku cloud service) gives me an NaN.

Also created test code that added a listener for the 'canplay' event and still get a duration of NaN using server.

This happens in FireFox and Chrome.

Any help would be appreciated.

A: 

It seems that Mongrel, and quite a few other servers, don't support byte-range requests. As such, the browser (for Ogg files) are unable to know the length of the video until the end is reached.

Here is an article on it: http://www.ruby-forum.com/topic/130850

Running Apache, which support byte-range requests I believe, works. The one thing to consider is to have enough keyframes in the Ogg file to improve on navigation (jumping around) in the ogg file.

DaUser2010