-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
…mple-camera-preview into video-single-cb-android
…cordova-plugin-simple-camera-preview into video-single-cb-android
…cordova-plugin-simple-camera-preview into video-single-cb-android
…mple-camera-preview into video-single-cb-android
if (recording != null) { | ||
recording.stop(); | ||
recording = null; | ||
} |
There was a problem hiding this comment.
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/SimpleCameraPreview.java
Outdated
@@ -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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PluginResult result = new PluginResult(PluginResult.Status.OK, "video cb initialized"); | |
PluginResult result = new PluginResult(PluginResult.Status.OK, "video callback initialized"); |
www/SimpleCameraPreview.js
Outdated
@@ -43,3 +78,4 @@ SimpleCameraPreview.deviceHasUltraWideCamera = function (onSuccess, onError) { | |||
}; | |||
|
|||
module.exports = SimpleCameraPreview; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
www/SimpleCameraPreview.js
Outdated
(err) => { | ||
this.videoCallback(null, err); | ||
}, | ||
"SimpleCameraPreview", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"SimpleCameraPreview", | |
PLUGIN_NAME, |
www/SimpleCameraPreview.js
Outdated
SimpleCameraPreview.videoInitialized = true; | ||
this.videoCallback(info); | ||
} , | ||
(err) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(err) => { | |
(err) => { |
www/SimpleCameraPreview.js
Outdated
exec( | ||
(info) => { | ||
SimpleCameraPreview.videoInitialized = true; | ||
this.videoCallback(info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.videoCallback(info); | |
onSuccess(info); |
www/SimpleCameraPreview.js
Outdated
@@ -16,17 +16,17 @@ SimpleCameraPreview.startVideoCapture = function (onSuccess, onError) { | |||
exec( | |||
(info) => { | |||
SimpleCameraPreview.videoInitialized = true; | |||
this.videoCallback(info); | |||
onSuccess(info); |
There was a problem hiding this comment.
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"});
…mple-camera-preview into video-single-cb-android
www/SimpleCameraPreview.js
Outdated
exec( | ||
(info) => { | ||
SimpleCameraPreview.videoInitialized = true; | ||
this.videoCallback({ tvideoCallback: true }); |
There was a problem hiding this comment.
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
@@ -2,6 +2,47 @@ var exec = require("cordova/exec"); | |||
var PLUGIN_NAME = "SimpleCameraPreview"; | |||
var SimpleCameraPreview = function () {}; | |||
|
|||
SimpleCameraPreview.videoInitialized = false; | |||
SimpleCameraPreview.videoCallback = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SimpleCameraPreview.videoCallback = null; |
I think videoInitialized
is enough and storing videoCallback
as global is not required
There was a problem hiding this comment.
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
…cordova-plugin-simple-camera-preview into video-single-cb-android
Co-authored-by: Zafir Sk Heerah <[email protected]>
…cordova-plugin-simple-camera-preview into video-single-cb-android
@@ -2,6 +2,47 @@ var exec = require("cordova/exec"); | |||
var PLUGIN_NAME = "SimpleCameraPreview"; | |||
var SimpleCameraPreview = function () {}; | |||
|
|||
SimpleCameraPreview.videoInitialized = false; | |||
SimpleCameraPreview.videoCallback = null; |
There was a problem hiding this comment.
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
} | ||
|
||
public void stopVideoCapture() { | ||
if (recording != null) { |
There was a problem hiding this comment.
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,
if (recording != null) { | |
if (recording != null && recording == true) { |
No description provided.