Re: idea for video tag and audio tag

On Tue, Jan 29, 2013 at 11:49 AM, GIDEON ISAAC <mad.gideon.isaac@hotmail.com
> wrote:

>  I have a website that lets people add information on videos and audio to
> my database.  When they enter the URL of the video, the website plays it
> for a second using the HTML5 video tag, which allows it to find information
> such as height and width and duration.  (With audio it would just be
> duration).  But it would also help if there was a way to get:
> 1. video codec
> 2. audio codec (both audio and video files have this)
> 3. video type - though this is usually obvious.
> It would be great if there was a set of 3 properties that you could read
> in javascript to obtain this information.
>

You can't get such information about an image file through a JavaScript API
either.
You have to do a XMLHttpRequest to get the header of the file and decode
and analyse it in JavaScript if you want more information about the type of
a file (something along this
http://emilsblog.lerch.org/2009/07/javascript-hacks-using-xhr-to-load.html).

> A reason to have this: once you have the information, you can then
specify it all when you play the videos, which makes it easier for the
browser.

If you're getting it via the video through a JS API, why would you want to
tell the browser about it again? It was the one to give you this
information in the first place.

> (It also helps you know if the browser supports the video codec or type).

That's what canPlayType() is for.

Cheers,
Silvia.

Received on Friday, 15 February 2013 06:16:01 UTC