apache / cordova-plugin-media

Apache Cordova Media Plugin
https://cordova.apache.org/
Apache License 2.0
388 stars 767 forks source link

Get frame(s) from Video stream #361

Open peterel opened 2 years ago

peterel commented 2 years ago

This is driving me nuts. Can someone please show me how to get the frames from a video stream? I get the stream using the example, see below, and that works well. But how do I go about getting each frame from that stream? Any help or tip is very very very welcome!

navigator.mediaDevices.getUserMedia(constraints)
    .then((stream) => {
      console.log('getUserMedia.stream', stream);
      console.log('getUserMedia.stream.getTracks', stream.getTracks());
      console.log("Im streaming!!", stream);
      var video = document.querySelector('video');
      console.log("video element", video);
      video.srcObject = stream;
      video.onloadedmetadata = (e) => {
        console.log("stream start");
        video.play();
      };
    }).catch((err) => {
      console.log('getUserMedia.error', err, err.stack);
    });
}
peterel commented 2 years ago

Sorry, wrong repo :)