user2302694
user2302694

Reputation: 601

Javascript manipulation of video tag

I am trying to play a video on an iPhone which is encoded as an MP4 but has the wrong extension and mime type (which can't be changed on the server).

If I use something like:

<video width="320" height="240" controls>
  <source src="internal.mp4" type="video/mp4">
  <Your browser does not support the video tag>
<video>

can I use Javascript / jQuery to make the video player think its play a file called internal.mp4 but is actually playing something like

http://192.168.0.1/video.tjc

Upvotes: 2

Views: 609

Answers (2)

codingjoe
codingjoe

Reputation: 1257

The source-tag's attribute type is made to define a MIME-type, meas your browser knows what to expect, but that isn't really the problem. MP4 is a MIME-type but that doesn't tell your browser which codec the video is compressed with. The file should do that but in your case it seems to be mixed up.

Anyways there is a Codec attribute in HTML5 as defined here: http://www.rfc-editor.org/rfc/rfc4281.txt

You should really read this, as it is the best intro into Web Video: http://diveintohtml5.info/video.html

Here you find a complete list of all codec type parameters: http://wiki.whatwg.org/wiki/Video_type_parameters

Upvotes: 1

Lemex
Lemex

Reputation: 3794

Try doing this:

$('#divVideo video source').attr('src', videoFile);

Then:

$("#divVideo video")[0].load();

Hope this helps!

Upvotes: 0

Related Questions