phonegap / phonegap-plugin-media-recorder

Apache License 2.0
14 stars 20 forks source link

Test playing blob data in video element #5

Open macdonst opened 7 years ago

macdonst commented 7 years ago

So after we successfully get a blob returned as the parameter to the ondataavailable event we should be able to set it to the src of a video element to be played. Please see if you can get it working:

navigator.mediaDevices.getUserMedia({
    'audio': true,
    'video': {facingMode: 'user'}
}).then(function(getmedia) {
    var track = getmedia.getVideoTracks()[0];
    var media = new MediaRecorder(getmedia);
    media.onstart = function() {
        console.log('start');
    };
    media.onstop = function() {
        console.log('stop');
        media.requestData();
    };
    media.ondataavailable = function(blob) {
        console.log('we got a blob');
        // how to play in video element
    };
    media.start();
});
macdonst commented 7 years ago

I've determined that the video tag doesn't support having a blob as the src of the video. We will need to document this quirk for plugin users.

I did some testing, talked to Max Firtman and caniuse all agree it does not work.