Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camera] Implement pausePreview and resumePreview #260

Merged
merged 2 commits into from Nov 25, 2021

Conversation

swift-kim
Copy link
Member

@swift-kim swift-kim commented Nov 2, 2021

  • Increase the frontend package version to 0.9.4.
  • Implement pausePreview and resumePreview. (Added in camera_platform_interface 2.1.0.)
  • Update example and miscellaneous files.

@bbrto21 The example app doesn't quite work smoothly on TM1, even with #258 applied to video_player_tizen. Could you take a look?

@github-actions github-actions bot added needs-publishing The package should be published after merge p: camera labels Nov 2, 2021
@bbrto21
Copy link
Contributor

bbrto21 commented Nov 8, 2021

@bbrto21 The example app doesn't quite work smoothly on TM1, even with #258 applied to video_player_tizen. Could you take a look?

I think it seems to be a similar issue with video plugin freezing. I'll open new issue

@swift-kim swift-kim marked this pull request as ready for review November 19, 2021 09:21
Comment on lines +996 to +1000
if (self->is_preview_paused_) {
media_packet_destroy(packet);
self->prepared_packet_ = nullptr;
return;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply discard the prepared packet when is_preview_paused_ is true, without stopping the preview itself (camera_stop_preview).

How do you like this approach? @bbrto21

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! but the relationship between Is_preview_paused_ and StopCameraPreview seems ambiguous. how about adding some comments?

Remark: Preview affects the state of the camera device. also it always pause the preview before start recording using StopCameraPreview

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I can safely call StopCameraPreview and StartCameraPreview at any time and it makes more sense to you, I'll change the implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm totally fine with current Implementation. but I'll check the safety when I get back to the office :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this change on a TM1 device today, but it didn't work as expected, because the capture API requires the camera state to be CAMERA_STATE_PREVIEW before capturing. Even if I call StartCameraPreview before calling StartCameraCapture and call StopCameraPreview again after the capture is finished, the call to StopCameraPreview results in an Invalid state error for unknown reason.

The problem of the current implementation is that the preview textures are not delivered to Flutter even when the user is recording a video. This is inconsistent with the Android side implementation. Let's revisit this issue when it's needed.

Copy link
Member

@bwikbs bwikbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@swift-kim
Copy link
Member Author

Another issue: Switching between camera devices (front and back cameras) leads to app freezing on TM1 devices quite frequently. The issue is not related to this PR.

@swift-kim swift-kim changed the title [camera] Update camera to 0.9.4 [camera] Implement pausePreview and resumePreview Nov 25, 2021
@swift-kim swift-kim merged commit 1771a18 into flutter-tizen:master Nov 25, 2021
bwikbs pushed a commit to bwikbs/plugins that referenced this pull request Mar 26, 2022
* [camera] Update camera to 0.9.4

* Implement pausePreview and resumePreview
@bbrto21
Copy link
Contributor

bbrto21 commented Oct 13, 2022

@swift-kim in this PR the test driver was deleted. however, no new test drivers were added. should we add new one?

@swift-kim
Copy link
Member Author

@bbrto21 Basically we don't need test drivers for most of our plugins, because we now run tests with integration_test but not flutter_driver any more. If you need a special environmental setup for testing this plugin, you can write a new test driver and run the test with flutter_driver (using the flutter-tizen drive command).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-publishing The package should be published after merge p: camera
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants