Questions/Comments on Media Stream Recording

I have a few comments/questions on the Media Stream Recording 5 Feb 2013 draft, http://www.w3.org/TR/2013/WD-mediastream-recording-20130205/

1. General comment - I think some examples would help clarify the document, especially for constructor use and linkage with getUserMedia

2, section 3.1 says

"An implementation must return a Blob in a format that is capable of being viewed in an HTML <img> tag. ."

I assume this is true only for image blobs, for video this could be the <video> tag but not if the blob is only a slice of a video. Thus it might make more sense to say that the blob is the binary form of an image or video portion.

3. I assume there is no way to create a recording and underlying stream in one step. Instead the process is to create a getUserMedia stream, then start recording, then end recording, then clean up the stream. Is this correct? 

In this case, how likely is it that incorrect javascript or error handling could leave an underlying getUserMedia stream intact despite recording failure or completion?

4. would it make sense to include the underlying getUserMedia stream as an stoprecording event parameter to allow cleanup without global variable for the underlying stream?

5. should there be any guidance on timeslice values? What is a reasonable maximum or is there a way to query the available buffer size?

Based on code from Eric Bidelman (simplified from http://html5-demos.appspot.com/status/getusermedia/photobooth.html ) the following might help with creating an example for the document, though it probably could use some correction:

HTML snippet

 <p><button onclick="init(this)">Capture</button></p>

<script>
    navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia;
    window.URL = window.URL || window.webkitURL;

    function dataAvailableCallback (data) {
	// e.g. send blob to server which builds recording of video
    }

  function stopCallback (stream) { // does callback receive underlying stream?

	stream.stop();
	// anything else?
 }

   function successCallback(stream) { 
	streamRecorder = MediaRecorder(stream, {onstop:  stopCallback ; ondataavailable: dataAvailableCallback} );
	if (!streamRecorder) {
	  console.log('could not record stream');
         stopCallback(stream);
          return;
       }

      streamRecorder.record(60000);  // return a minute at a time
  }

  function errorCallback(error) {
       console.log('Unable to get video stream [CODE '+  error.code + ']!' + error);  
       return;
  }

  function init(el) {
      if (!navigator.getUserMedia) {
          console.log('native web camera not supported');
        return;
      }
      navigator.getUserMedia({ video: true}, successCallback, errorCallback);
  }
 </script>

thanks

regards, Frederick

Frederick Hirsch
Nokia

Received on Wednesday, 22 May 2013 18:28:11 UTC