File tree 4 files changed +16
-0
lines changed
4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 13
13
## 0.3.0
14
14
15
15
* Update camera to 0.9.4.
16
+ * Implement ` pausePreview ` and ` resumePreview ` .
16
17
* Update the example app and integration_test.
17
18
* Remove the unused test driver.
Original file line number Diff line number Diff line change @@ -993,6 +993,11 @@ void CameraDevice::Open(
993
993
self->prepared_packet_ = packet;
994
994
return ;
995
995
}
996
+ if (self->is_preview_paused_ ) {
997
+ media_packet_destroy (packet);
998
+ self->prepared_packet_ = nullptr ;
999
+ return ;
1000
+ }
996
1001
self->prepared_packet_ = packet;
997
1002
self->registrar_ ->texture_registrar ()->MarkTextureFrameAvailable (
998
1003
self->texture_id_ );
Original file line number Diff line number Diff line change @@ -250,6 +250,9 @@ class CameraDevice {
250
250
void LockCaptureOrientation (OrientationType orientation);
251
251
void UnlockCaptureOrientation ();
252
252
253
+ void PausePreview () { is_preview_paused_ = true ; }
254
+ void ResumePreview () { is_preview_paused_ = false ; }
255
+
253
256
private:
254
257
bool CreateCamera ();
255
258
bool ClearCameraAutoFocusArea ();
@@ -357,6 +360,7 @@ class CameraDevice {
357
360
std::vector<std::pair<int , int >> supported_recorder_resolutions_;
358
361
359
362
bool enable_audio_{true };
363
+ bool is_preview_paused_{false };
360
364
};
361
365
362
366
#endif
Original file line number Diff line number Diff line change @@ -301,6 +301,12 @@ class CameraPlugin : public flutter::Plugin {
301
301
} else if (method_name == " unlockCaptureOrientation" ) {
302
302
camera_->UnlockCaptureOrientation ();
303
303
result->Success ();
304
+ } else if (method_name == " pausePreview" ) {
305
+ camera_->PausePreview ();
306
+ result->Success ();
307
+ } else if (method_name == " resumePreview" ) {
308
+ camera_->ResumePreview ();
309
+ result->Success ();
304
310
} else if (method_name == " dispose" ) {
305
311
if (camera_) {
306
312
camera_->Dispose ();
You can’t perform that action at this time.
0 commit comments