views:

117

answers:

2

For my goals I'm using html5 and tag < video> to add a media content to page. I've found how to control video by JavaScript(stop, play, load). But is there any ways to modify processing video stream.

I'm trying to find a solutions how to add my sequence of bytes into downloaded stream: e.g modify header of file before playing.

Thanks

A: 

A <video> element can be manipulated visually similarly to a <canvas> element. Take a look at this article at the Mozilla Hacks blog for a few good examples of what you can do with HTML5 video: http://hacks.mozilla.org/2009/06/pop-art-video/

But as far as modifying the actual video data stream, there isn't really a way to do that on the client side.

awgy
To be precise, you can manipulate the video after drawing it to a canvas. This is very slow though and only useful for demos.
foolip
+1  A: 

There's no API for modifying the video stream bytes in the video element.

You can:

  • Draw the current frame of the video element on canvas
  • Apply an SVG filter to the video element (in Gecko)
  • Use vendor-specific XMLHttpRequest extensions to read the bytes of the video file in JavaScript, modify the data, construct a data: URL from the data and load the data: URL into the video element.
hsivonen