Flutter version: Flutter (Channel master, v1.18.1-pre.9, on Mac OS X 10.15.1 19B88, locale en-RS)
Android studio details:
Android Studio 3.6.1
Build #AI-192.7142.36.36.6241897, built on February 27, 2020
Runtime version: 1.8.0_212-release-1586-b4-5784211 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.1
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: ide.new.welcome.screen.force=true, ide.mac.allowDarkWindowDecorations=true, debugger.showTypes=false, ide.balloon.shadow.size=0
What did you do?
Due to our project requirements, we need to have an ability for a user to take a photo during video calls and send that image to the other participants. In order to do something like that we explored multiple approaches and the only viable approach would be to use captureFrame(path) method that Flutter WebRTC provides on local video MediaStreamTrack. The main reason for such a decision is that Ion SDK "locks" the camera even when you disabled it, and you can't open a second session for that camera until local video stream is connected. It would be very bad UX that user just disappears when he wants to take the photo and that is why we chose to utilize captureFrame(path) method since it exists.
In order to do something like this we simply changed in your example project in pubspec.yaml we added a dependency:
path_provider:
and in the meeting_page.dart:
//Switch local camera
_switchCamera() async {
if (_localVideo != null && _localVideo.stream.getVideoTracks().length > 0) {
//_localVideo.stream.getVideoTracks()[0].switchCamera();
final storagePath = await getTemporaryDirectory();
final filePath = storagePath.path + '/test.jpg';
_localVideo.stream.getVideoTracks()[0].captureFrame(filePath);
} else {
_showSnackBar(":::Unable to switch the camera:::");
}
}
Your environment.
What did you do?
Due to our project requirements, we need to have an ability for a user to take a photo during video calls and send that image to the other participants. In order to do something like that we explored multiple approaches and the only viable approach would be to use
captureFrame(path)
method that Flutter WebRTC provides on local videoMediaStreamTrack
. The main reason for such a decision is that Ion SDK "locks" the camera even when you disabled it, and you can't open a second session for that camera until local video stream is connected. It would be very bad UX that user just disappears when he wants to take the photo and that is why we chose to utilizecaptureFrame(path)
method since it exists.In order to do something like this we simply changed in your example project in
pubspec.yaml
we added a dependency:and in the
meeting_page.dart
:In
ios/Runner/Info.plist
we added:What did you expect?
Application should capture a frame and save it in the JPG file.
What happened?
The application crashed without any stacktrace when run on iOS 13.2.
We also tested the official Web RTC sample which supports
captureFrame
and it worked as expected without any crash.