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

single callback video event #81

Merged
merged 23 commits into from
Aug 16, 2024
Merged

single callback video event #81

merged 23 commits into from
Aug 16, 2024

Conversation

dinitri
Copy link
Member

@dinitri dinitri commented Jul 5, 2024

No description provided.

Comment on lines 303 to 306
if (recording != null) {
recording.stop();
recording = null;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

we can stopVideoCapture directly

src/android/CameraPreviewFragment.java Outdated Show resolved Hide resolved
src/android/CameraPreviewFragment.java Outdated Show resolved Hide resolved
src/android/CameraPreviewFragment.java Outdated Show resolved Hide resolved
src/android/CameraPreviewFragment.java Outdated Show resolved Hide resolved
src/android/SimpleCameraPreview.java Outdated Show resolved Hide resolved
src/android/SimpleCameraPreview.java Outdated Show resolved Hide resolved
src/android/SimpleCameraPreview.java Outdated Show resolved Hide resolved
www/SimpleCameraPreview.js Outdated Show resolved Hide resolved
@@ -92,6 +103,89 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
}
}

private boolean initVideoCallback(CallbackContext callbackContext) {
this.videoCallbackContext = callbackContext;
PluginResult result = new PluginResult(PluginResult.Status.OK, "video cb initialized");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
PluginResult result = new PluginResult(PluginResult.Status.OK, "video cb initialized");
PluginResult result = new PluginResult(PluginResult.Status.OK, "video callback initialized");

@@ -43,3 +78,4 @@ SimpleCameraPreview.deviceHasUltraWideCamera = function (onSuccess, onError) {
};

module.exports = SimpleCameraPreview;

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

(err) => {
this.videoCallback(null, err);
},
"SimpleCameraPreview",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"SimpleCameraPreview",
PLUGIN_NAME,

SimpleCameraPreview.videoInitialized = true;
this.videoCallback(info);
} ,
(err) => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
(err) => {
(err) => {

www/SimpleCameraPreview.js Show resolved Hide resolved
exec(
(info) => {
SimpleCameraPreview.videoInitialized = true;
this.videoCallback(info);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
this.videoCallback(info);
onSuccess(info);

@@ -16,17 +16,17 @@ SimpleCameraPreview.startVideoCapture = function (onSuccess, onError) {
exec(
(info) => {
SimpleCameraPreview.videoInitialized = true;
this.videoCallback(info);
onSuccess(info);
Copy link
Contributor

Choose a reason for hiding this comment

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

      this.videoCallback({videocb: "video initialiazed"});

exec(
(info) => {
SimpleCameraPreview.videoInitialized = true;
this.videoCallback({ tvideoCallback: true });
Copy link
Member Author

@dinitri dinitri Aug 2, 2024

Choose a reason for hiding this comment

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

tvideoCallback. ?
c'est pas plutot un truc du genre videoCallbackInitialized @YushraJewon

www/SimpleCameraPreview.js Outdated Show resolved Hide resolved
@@ -2,6 +2,47 @@ var exec = require("cordova/exec");
var PLUGIN_NAME = "SimpleCameraPreview";
var SimpleCameraPreview = function () {};

SimpleCameraPreview.videoInitialized = false;
SimpleCameraPreview.videoCallback = null;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
SimpleCameraPreview.videoCallback = null;

I think videoInitialized is enough and storing videoCallback as global is not required

Copy link
Member Author

Choose a reason for hiding this comment

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

@zfir we can consider it as a refactoring for the next version

YushraJewon and others added 4 commits August 12, 2024 10:28
…cordova-plugin-simple-camera-preview into video-single-cb-android
…cordova-plugin-simple-camera-preview into video-single-cb-android
www/SimpleCameraPreview.js Outdated Show resolved Hide resolved
@@ -2,6 +2,47 @@ var exec = require("cordova/exec");
var PLUGIN_NAME = "SimpleCameraPreview";
var SimpleCameraPreview = function () {};

SimpleCameraPreview.videoInitialized = false;
SimpleCameraPreview.videoCallback = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

@zfir we can consider it as a refactoring for the next version

@YushraJewon YushraJewon merged commit f152859 into master Aug 16, 2024
1 check passed
}

public void stopVideoCapture() {
if (recording != null) {
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 think we have to put this,

Suggested change
if (recording != null) {
if (recording != null && recording == true) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants