RE: can we generate a stream from local file

> -----Original Message-----
> From: Stefan Hakansson LK [mailto:stefan.lk.hakansson@ericsson.com]
> On 07/30/2012 11:08 AM, Sunyang (Eric) wrote:
> > Can we generate a stream from a file, and then use addStream() to send
> > it to peer?
> 
> That is the intention.

We should simply extend MediaStreamTrackList:add for this scenario (see below). However, I'm skeptical that you'd want to be able to "stream" arbitrary files as a media stream track. For example, what would happen if you tried to send a PDF or HTML document as a stream? It just doesn't make sense. If that's your goal, what you want is simply a Blob-based file transfer mechanism (peer-to-peer). I doubt that real-time media transfer is the transfer mechanism you would want for that.

Regarding streaming (or capture) of other visible media content from a web page, I would propose simply extending the MediaStreamTrackList:add API as follows:

void add((MediaStreamTrack or HTMLImageElement or HTMLCanvasElement or HTMLMediaElement) track);

This augmented API would add the provided track, or in the case of the image/canvas/video/audio element, would create a new video track based on a snapshot of those elements' contents at that moment in time and add the new track to the videoTracks list. To be clear the track would just keep sending that same snapshot image the entire time its enabled (unless we want to make an exception for an HTMLMediaElement).

Received on Monday, 30 July 2012 17:07:55 UTC