dustin.b
dustin.b

Reputation: 1275

Dynamically create video (stream) with createObjectURL

I wonder if it is possible to create a html5 video on the fly. Some of you may noticed the new webrtc and its behavior with the video tag.

navigator.webkitGetUserMedia('video', gotStream, noStream);

function gotStream(stream) { 
  video.src = webkitURL.createObjectURL(stream);
}

what exactly is that "stream" in gotStream(stream) what is that "interface" looks like so i can generate one of my own? May it be by computing things or by just receiving data from server to display the video. Secound how do i get the data out of this "stream"? So i can read it from one users webcam to send it to my server and let it pass through the receiving user. Binary data transmission is no topic of my question, i already have this working. I just need the data from the "stream" from one user and reconstruct that "stream" on the target user who wanna see user ones webcam.

Any further information on "where to get these infos by my self" (API Docu sort of) would be also very helpful, cuz i cant find any.

I am aware of the PeerConnection stuff, so no need to mention it here. Cuz beside that webcam stuff i would love to pipe dynamically generated videos from my server to the client or make some sort of video transmitting over dynamic changeable bandwidth with ffmpeg etc. but for this i need to pipe that data to that video element

Upvotes: 3

Views: 2101

Answers (1)

Frank Schwieterman
Frank Schwieterman

Reputation: 24480

You may want to look at Whammy: http://antimatter15.com/wp/2012/08/whammy-a-real-time-javascript-webm-encoder/.

For now, you can periodically copy a video element screen to a canvas, then save that canvas to build a video. Whammy ties together webp images generated from a canvas into a webm file, taking advantage of the similarities of the webp (image) and webm (video) format.

You could generate other images and stitch them together in the same manner. Note that this does not support audio.

Upvotes: 1

Related Questions