File tree Expand file tree Collapse file tree 17 files changed +89
-60
lines changed
camera_platform_interface Expand file tree Collapse file tree 17 files changed +89
-60
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ flutter:
2323dependencies :
2424 camera_android : ^0.10.1
2525 camera_avfoundation : ^0.10.0
26- camera_platform_interface : ^2.3.0
26+ camera_platform_interface : ^2.3.1
2727 camera_web : ^0.3.1
2828 flutter :
2929 sdk : flutter
Original file line number Diff line number Diff line change @@ -216,18 +216,16 @@ class MockStreamingCameraPlatform extends MockCameraPlatform {
216216
217217 @override
218218 Future <XFile > startVideoRecording (int cameraId,
219- {Duration ? maxVideoDuration,
220- Function (CameraImageData image)? streamCallback,
221- CameraImageStreamOptions ? streamOptions}) {
222- if (streamCallback == null ) {
223- streamCallLog.add ('startVideoRecording without stream' );
224- } else {
225- streamCallLog.add ('startVideoRecording with stream' );
226- }
227- return super .startVideoRecording (cameraId,
228- maxVideoDuration: maxVideoDuration,
229- streamCallback: streamCallback,
230- streamOptions: streamOptions);
219+ {Duration ? maxVideoDuration}) {
220+ streamCallLog.add ('startVideoRecording' );
221+ return super
222+ .startVideoRecording (cameraId, maxVideoDuration: maxVideoDuration);
223+ }
224+
225+ @override
226+ Future <void > startVideoCapturing (VideoCaptureOptions options) {
227+ streamCallLog.add ('startVideoCapturing' );
228+ return super .startVideoCapturing (options);
231229 }
232230
233231 void _onFrameStreamListen () {
Original file line number Diff line number Diff line change @@ -1433,11 +1433,15 @@ class MockCameraPlatform extends Mock
14331433
14341434 @override
14351435 Future <XFile > startVideoRecording (int cameraId,
1436- {Duration ? maxVideoDuration,
1437- Function (CameraImageData image)? streamCallback,
1438- CameraImageStreamOptions ? streamOptions}) =>
1436+ {Duration ? maxVideoDuration}) =>
14391437 Future <XFile >.value (mockVideoRecordingXFile);
14401438
1439+ @override
1440+ Future <void > startVideoCapturing (VideoCaptureOptions options) {
1441+ return startVideoRecording (options.cameraId,
1442+ maxVideoDuration: options.maxDuration);
1443+ }
1444+
14411445 @override
14421446 Future <void > lockCaptureOrientation (
14431447 int ? cameraId, DeviceOrientation ? orientation) async =>
Original file line number Diff line number Diff line change @@ -308,8 +308,8 @@ class CameraController extends ValueNotifier<CameraValue> {
308308 /// Throws a [CameraException] if the capture fails.
309309 Future <void > startVideoRecording (
310310 {Function (CameraImageData image)? streamCallback}) async {
311- await CameraPlatform .instance
312- . startVideoRecording (_cameraId, streamCallback: streamCallback);
311+ await CameraPlatform .instance. startVideoCapturing (
312+ VideoCaptureOptions (_cameraId, streamCallback: streamCallback) );
313313 value = value.copyWith (
314314 isRecordingVideo: true ,
315315 isRecordingPaused: false ,
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ dependencies:
1414 # The example app is bundled with the plugin so we use a path dependency on
1515 # the parent directory to use the current plugin's version.
1616 path : ../
17- camera_platform_interface : ^2.2.0
17+ camera_platform_interface : ^2.3.1
1818 flutter :
1919 sdk : flutter
2020 path_provider : ^2.0.0
Original file line number Diff line number Diff line change @@ -247,20 +247,24 @@ class AndroidCamera extends CameraPlatform {
247247
248248 @override
249249 Future <void > startVideoRecording (int cameraId,
250- {Duration ? maxVideoDuration,
251- Function (CameraImageData image)? streamCallback,
252- CameraImageStreamOptions ? streamOptions}) async {
250+ {Duration ? maxVideoDuration}) async {
251+ return startVideoCapturing (
252+ VideoCaptureOptions (cameraId, maxDuration: maxVideoDuration));
253+ }
254+
255+ @override
256+ Future <void > startVideoCapturing (VideoCaptureOptions options) async {
253257 await _channel.invokeMethod <void >(
254258 'startVideoRecording' ,
255259 < String , dynamic > {
256- 'cameraId' : cameraId,
257- 'maxVideoDuration' : maxVideoDuration ? .inMilliseconds,
258- 'enableStream' : streamCallback != null ,
260+ 'cameraId' : options. cameraId,
261+ 'maxVideoDuration' : options.maxDuration ? .inMilliseconds,
262+ 'enableStream' : options. streamCallback != null ,
259263 },
260264 );
261265
262- if (streamCallback != null ) {
263- _installStreamController ().stream.listen (streamCallback);
266+ if (options. streamCallback != null ) {
267+ _installStreamController ().stream.listen (options. streamCallback);
264268 _startStreamListener ();
265269 }
266270 }
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ flutter:
1818 dartPluginClass : AndroidCamera
1919
2020dependencies :
21- camera_platform_interface : ^2.3.0
21+ camera_platform_interface :
22+ path : ../camera_platform_interface
2223 flutter :
2324 sdk : flutter
2425 flutter_plugin_android_lifecycle : ^2.0.2
Original file line number Diff line number Diff line change @@ -250,18 +250,24 @@ class AVFoundationCamera extends CameraPlatform {
250250 {Duration ? maxVideoDuration,
251251 Function (CameraImageData image)? streamCallback,
252252 CameraImageStreamOptions ? streamOptions}) async {
253+ return startVideoCapturing (
254+ VideoCaptureOptions (cameraId, maxDuration: maxVideoDuration));
255+ }
256+
257+ @override
258+ Future <void > startVideoCapturing (VideoCaptureOptions options) async {
253259 await _channel.invokeMethod <void >(
254260 'startVideoRecording' ,
255261 < String , dynamic > {
256- 'cameraId' : cameraId,
257- 'maxVideoDuration' : maxVideoDuration ? .inMilliseconds,
258- 'enableStream' : streamCallback != null ,
262+ 'cameraId' : options. cameraId,
263+ 'maxVideoDuration' : options.maxDuration ? .inMilliseconds,
264+ 'enableStream' : options. streamCallback != null ,
259265 },
260266 );
261267
262- if (streamCallback != null ) {
268+ if (options. streamCallback != null ) {
263269 _frameStreamController = _createStreamController ();
264- _frameStreamController! .stream.listen (streamCallback);
270+ _frameStreamController! .stream.listen (options. streamCallback);
265271 _startStreamListener ();
266272 }
267273 }
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ flutter:
1717 dartPluginClass : AVFoundationCamera
1818
1919dependencies :
20- camera_platform_interface : ^2.3.0
20+ camera_platform_interface : ^2.3.1
2121 flutter :
2222 sdk : flutter
2323 stream_transform : ^2.0.0
Original file line number Diff line number Diff line change 1+ ## 2.3.1
2+
3+ * Exports VideoCaptureOptions to allow dependencies to implement concurrent stream and record
4+
15## 2.3.0
26
37* Adds new capture method for a camera to allow concurrent streaming and recording.
You can’t perform that action at this time.
0 commit comments