dart-lang / sdk

The Dart SDK, including the VM, dart2js, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
9.98k stars 1.54k forks source link

MediaRecorder #32763

Open drpond1 opened 6 years ago

drpond1 commented 6 years ago

Missing the function MediaRecorder.ondataavailable

kevmoo commented 6 years ago

Looks like it is available in modern browsers: https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/ondataavailable

drpond1 commented 5 years ago

Update on any plans to address this issue is requested.

https://www.w3.org/TR/mediastream-recording/

rostopira commented 4 years ago

MediaRecorder is useless without it, but there is a workaround

    _recorder.addEventListener('dataavailable', (Event event) {
        print("datavailable ${event.runtimeType}");
        final Blob blob = JsObject.fromBrowserObject(event)['data'];
        print("blob size: ${blob.size}");
   });
drpond1 commented 4 years ago

Thank you for your help.

drpond1 commented 2 years ago

There is now a solution that does not need JSObject that I only now discovered when changing from dart:js to the js/dart.js package.

Simply check the Event is a BlobEvent and then cast it. castedBlobEvent.data returns the desired Blob?