Skip to content

Commit b14ab23

Browse files
committed
Implement pausePreview and resumePreview
1 parent 7ddcf77 commit b14ab23

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

packages/camera/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
## 0.3.0
1414

1515
* Update camera to 0.9.4.
16+
* Implement `pausePreview` and `resumePreview`.
1617
* Update the example app and integration_test.
1718
* Remove the unused test driver.

packages/camera/tizen/src/camera_device.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,11 @@ void CameraDevice::Open(
993993
self->prepared_packet_ = packet;
994994
return;
995995
}
996+
if (self->is_preview_paused_) {
997+
media_packet_destroy(packet);
998+
self->prepared_packet_ = nullptr;
999+
return;
1000+
}
9961001
self->prepared_packet_ = packet;
9971002
self->registrar_->texture_registrar()->MarkTextureFrameAvailable(
9981003
self->texture_id_);

packages/camera/tizen/src/camera_device.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ class CameraDevice {
250250
void LockCaptureOrientation(OrientationType orientation);
251251
void UnlockCaptureOrientation();
252252

253+
void PausePreview() { is_preview_paused_ = true; }
254+
void ResumePreview() { is_preview_paused_ = false; }
255+
253256
private:
254257
bool CreateCamera();
255258
bool ClearCameraAutoFocusArea();
@@ -357,6 +360,7 @@ class CameraDevice {
357360
std::vector<std::pair<int, int>> supported_recorder_resolutions_;
358361

359362
bool enable_audio_{true};
363+
bool is_preview_paused_{false};
360364
};
361365

362366
#endif

packages/camera/tizen/src/camera_plugin.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ class CameraPlugin : public flutter::Plugin {
301301
} else if (method_name == "unlockCaptureOrientation") {
302302
camera_->UnlockCaptureOrientation();
303303
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();
304310
} else if (method_name == "dispose") {
305311
if (camera_) {
306312
camera_->Dispose();

0 commit comments

Comments
 (0)