Stream local media file from browser


It would be useful letting user to choose a media file from the local computer and stream it to other participants in the room. According to the documentation the Stream API supports file as an option:

var stream = Erizo.Stream({video: true, audio: false, url:"file:///path_to_file/movie.mkv"});

But since browsers do not allow to access local file due to security reasons so I assume the file is used by the MCU in the server side not the client.

One idea to create stream in the client is blob that can be generated by URL.createObjectURL().

Another approach is MediaElement.captureStream() that creates a stream from the audio/video element. Then we need the API to support native MediaStream as input.


I could get it to work by creating an audio stream (Erizo.Stream({ audio: true })) and then overwriting the stream on access-accepted event:

stream.addEventListener('access-accepted', function(event) { = true; = true; = videoElement.captureStream();

But it’s kind of hack and I rather prefer to have an option for creating a fake stream for example by using an empty constraint ({}) and then set my desired stream before publishing it.