@capgo/camera-preview 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CapgoCameraPreview.podspec +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +431 -0
  4. package/android/.project +17 -0
  5. package/android/build.gradle +55 -0
  6. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  7. package/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  8. package/android/gradle.properties +18 -0
  9. package/android/gradlew +160 -0
  10. package/android/gradlew.bat +90 -0
  11. package/android/proguard-rules.pro +21 -0
  12. package/android/settings.gradle +2 -0
  13. package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +26 -0
  14. package/android/src/main/AndroidManifest.xml +5 -0
  15. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +967 -0
  16. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +507 -0
  17. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomSurfaceView.java +23 -0
  18. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +29 -0
  19. package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +386 -0
  20. package/android/src/main/java/com/ahm/capacitor/camera/preview/TapGestureDetector.java +24 -0
  21. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  22. package/android/src/main/res/layout/camera_activity.xml +68 -0
  23. package/android/src/main/res/values/camera_ids.xml +4 -0
  24. package/android/src/main/res/values/camera_theme.xml +9 -0
  25. package/android/src/main/res/values/colors.xml +3 -0
  26. package/android/src/main/res/values/strings.xml +3 -0
  27. package/android/src/main/res/values/styles.xml +3 -0
  28. package/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +18 -0
  29. package/dist/esm/definitions.d.ts +74 -0
  30. package/dist/esm/definitions.js +2 -0
  31. package/dist/esm/definitions.js.map +1 -0
  32. package/dist/esm/index.d.ts +4 -0
  33. package/dist/esm/index.js +7 -0
  34. package/dist/esm/index.js.map +1 -0
  35. package/dist/esm/web.d.ts +24 -0
  36. package/dist/esm/web.js +135 -0
  37. package/dist/esm/web.js.map +1 -0
  38. package/ios/Plugin/CameraController.swift +647 -0
  39. package/ios/Plugin/Info.plist +24 -0
  40. package/ios/Plugin/Plugin.h +10 -0
  41. package/ios/Plugin/Plugin.m +16 -0
  42. package/ios/Plugin/Plugin.swift +291 -0
  43. package/ios/Plugin.xcodeproj/project.pbxproj +595 -0
  44. package/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  45. package/ios/Plugin.xcworkspace/contents.xcworkspacedata +10 -0
  46. package/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  47. package/ios/PluginTests/Info.plist +22 -0
  48. package/ios/PluginTests/PluginTests.swift +35 -0
  49. package/ios/Podfile +13 -0
  50. package/ios/Podfile.lock +23 -0
  51. package/package.json +76 -0
@@ -0,0 +1,507 @@
1
+ package com.ahm.capacitor.camera.preview;
2
+
3
+ import static android.Manifest.permission.CAMERA;
4
+
5
+ import android.app.FragmentManager;
6
+ import android.app.FragmentTransaction;
7
+ import android.content.pm.ActivityInfo;
8
+ import android.graphics.Color;
9
+ import android.graphics.Point;
10
+ import android.hardware.Camera;
11
+ import android.util.DisplayMetrics;
12
+ import android.util.TypedValue;
13
+ import android.view.Display;
14
+ import android.view.MotionEvent;
15
+ import android.view.View;
16
+ import android.view.ViewGroup;
17
+ import android.widget.FrameLayout;
18
+ import com.getcapacitor.JSObject;
19
+ import com.getcapacitor.Logger;
20
+ import com.getcapacitor.PermissionState;
21
+ import com.getcapacitor.Plugin;
22
+ import com.getcapacitor.PluginCall;
23
+ import com.getcapacitor.PluginMethod;
24
+ import com.getcapacitor.annotation.CapacitorPlugin;
25
+ import com.getcapacitor.annotation.Permission;
26
+ import com.getcapacitor.annotation.PermissionCallback;
27
+ import java.io.File;
28
+ import java.util.List;
29
+ import org.json.JSONArray;
30
+
31
+ @CapacitorPlugin(name = "CameraPreview", permissions = { @Permission(strings = { CAMERA }, alias = CameraPreview.CAMERA_PERMISSION_ALIAS) })
32
+ public class CameraPreview extends Plugin implements CameraActivity.CameraPreviewListener {
33
+
34
+ static final String CAMERA_PERMISSION_ALIAS = "camera";
35
+
36
+ private static String VIDEO_FILE_PATH = "";
37
+ private static String VIDEO_FILE_EXTENSION = ".mp4";
38
+
39
+ private String captureCallbackId = "";
40
+ private String snapshotCallbackId = "";
41
+ private String recordCallbackId = "";
42
+ private String cameraStartCallbackId = "";
43
+
44
+ // keep track of previously specified orientation to support locking orientation:
45
+ private int previousOrientationRequest = -1;
46
+
47
+ private CameraActivity fragment;
48
+ private int containerViewId = 20;
49
+
50
+ @PluginMethod
51
+ public void echo(PluginCall call) {
52
+ String value = call.getString("value");
53
+
54
+ JSObject ret = new JSObject();
55
+ ret.put("value", value);
56
+ call.resolve(ret);
57
+ }
58
+
59
+ @PluginMethod
60
+ public void start(PluginCall call) {
61
+ if (PermissionState.GRANTED.equals(getPermissionState(CAMERA_PERMISSION_ALIAS))) {
62
+ startCamera(call);
63
+ } else {
64
+ requestPermissionForAlias(CAMERA_PERMISSION_ALIAS, call, "handleCameraPermissionResult");
65
+ }
66
+ }
67
+
68
+ @PluginMethod
69
+ public void flip(PluginCall call) {
70
+ try {
71
+ fragment.switchCamera();
72
+ call.resolve();
73
+ } catch (Exception e) {
74
+ Logger.debug(getLogTag(), "Camera flip exception: " + e);
75
+ call.reject("failed to flip camera");
76
+ }
77
+ }
78
+
79
+ @PluginMethod
80
+ public void setOpacity(PluginCall call) {
81
+ if (this.hasCamera(call) == false) {
82
+ call.error("Camera is not running");
83
+ return;
84
+ }
85
+
86
+ bridge.saveCall(call);
87
+ Float opacity = call.getFloat("opacity", 1F);
88
+ fragment.setOpacity(opacity);
89
+ }
90
+
91
+ @PluginMethod
92
+ public void capture(PluginCall call) {
93
+ if (this.hasCamera(call) == false) {
94
+ call.reject("Camera is not running");
95
+ return;
96
+ }
97
+ bridge.saveCall(call);
98
+ captureCallbackId = call.getCallbackId();
99
+
100
+ Integer quality = call.getInt("quality", 85);
101
+ // Image Dimensions - Optional
102
+ Integer width = call.getInt("width", 0);
103
+ Integer height = call.getInt("height", 0);
104
+ fragment.takePicture(width, height, quality);
105
+ }
106
+
107
+ @PluginMethod
108
+ public void captureSample(PluginCall call) {
109
+ if (this.hasCamera(call) == false) {
110
+ call.reject("Camera is not running");
111
+ return;
112
+ }
113
+ bridge.saveCall(call);
114
+ snapshotCallbackId = call.getCallbackId();
115
+
116
+ Integer quality = call.getInt("quality", 85);
117
+ fragment.takeSnapshot(quality);
118
+ }
119
+
120
+ @PluginMethod
121
+ public void stop(final PluginCall call) {
122
+ bridge
123
+ .getActivity()
124
+ .runOnUiThread(
125
+ new Runnable() {
126
+ @Override
127
+ public void run() {
128
+ FrameLayout containerView = getBridge().getActivity().findViewById(containerViewId);
129
+
130
+ // allow orientation changes after closing camera:
131
+ getBridge().getActivity().setRequestedOrientation(previousOrientationRequest);
132
+
133
+ if (containerView != null) {
134
+ ((ViewGroup) getBridge().getWebView().getParent()).removeView(containerView);
135
+ getBridge().getWebView().setBackgroundColor(Color.WHITE);
136
+ FragmentManager fragmentManager = getActivity().getFragmentManager();
137
+ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
138
+ fragmentTransaction.remove(fragment);
139
+ fragmentTransaction.commit();
140
+ fragment = null;
141
+
142
+ call.resolve();
143
+ } else {
144
+ call.reject("camera already stopped");
145
+ }
146
+ }
147
+ }
148
+ );
149
+ }
150
+
151
+ @PluginMethod
152
+ public void getSupportedFlashModes(PluginCall call) {
153
+ if (this.hasCamera(call) == false) {
154
+ call.reject("Camera is not running");
155
+ return;
156
+ }
157
+
158
+ Camera camera = fragment.getCamera();
159
+ Camera.Parameters params = camera.getParameters();
160
+ List<String> supportedFlashModes;
161
+ supportedFlashModes = params.getSupportedFlashModes();
162
+ JSONArray jsonFlashModes = new JSONArray();
163
+
164
+ if (supportedFlashModes != null) {
165
+ for (int i = 0; i < supportedFlashModes.size(); i++) {
166
+ jsonFlashModes.put(new String(supportedFlashModes.get(i)));
167
+ }
168
+ }
169
+
170
+ JSObject jsObject = new JSObject();
171
+ jsObject.put("result", jsonFlashModes);
172
+ call.resolve(jsObject);
173
+ }
174
+
175
+ @PluginMethod
176
+ public void setFlashMode(PluginCall call) {
177
+ if (this.hasCamera(call) == false) {
178
+ call.reject("Camera is not running");
179
+ return;
180
+ }
181
+
182
+ String flashMode = call.getString("flashMode");
183
+ if (flashMode == null || flashMode.isEmpty() == true) {
184
+ call.reject("flashMode required parameter is missing");
185
+ return;
186
+ }
187
+
188
+ Camera camera = fragment.getCamera();
189
+ Camera.Parameters params = camera.getParameters();
190
+
191
+ List<String> supportedFlashModes;
192
+ supportedFlashModes = camera.getParameters().getSupportedFlashModes();
193
+ if (supportedFlashModes.indexOf(flashMode) > -1) {
194
+ params.setFlashMode(flashMode);
195
+ } else {
196
+ call.reject("Flash mode not recognised: " + flashMode);
197
+ return;
198
+ }
199
+
200
+ fragment.setCameraParameters(params);
201
+
202
+ call.resolve();
203
+ }
204
+
205
+ @PluginMethod
206
+ public void startRecordVideo(final PluginCall call) {
207
+ if (this.hasCamera(call) == false) {
208
+ call.reject("Camera is not running");
209
+ return;
210
+ }
211
+ final String filename = "videoTmp";
212
+ VIDEO_FILE_PATH = getActivity().getCacheDir().toString() + "/";
213
+
214
+ final String position = call.getString("position", "front");
215
+ final Integer width = call.getInt("width", 0);
216
+ final Integer height = call.getInt("height", 0);
217
+ final Boolean withFlash = call.getBoolean("withFlash", false);
218
+ final Integer maxDuration = call.getInt("maxDuration", 0);
219
+ // final Integer quality = call.getInt("quality", 0);
220
+ bridge.saveCall(call);
221
+ recordCallbackId = call.getCallbackId();
222
+
223
+ bridge
224
+ .getActivity()
225
+ .runOnUiThread(
226
+ new Runnable() {
227
+ @Override
228
+ public void run() {
229
+ // fragment.startRecord(getFilePath(filename), position, width, height, quality, withFlash);
230
+ fragment.startRecord(getFilePath(filename), position, width, height, 70, withFlash, maxDuration);
231
+ }
232
+ }
233
+ );
234
+
235
+ call.resolve();
236
+ }
237
+
238
+ @PluginMethod
239
+ public void stopRecordVideo(PluginCall call) {
240
+ if (this.hasCamera(call) == false) {
241
+ call.reject("Camera is not running");
242
+ return;
243
+ }
244
+
245
+ System.out.println("stopRecordVideo - Callbackid=" + call.getCallbackId());
246
+
247
+ bridge.saveCall(call);
248
+ recordCallbackId = call.getCallbackId();
249
+
250
+ // bridge.getActivity().runOnUiThread(new Runnable() {
251
+ // @Override
252
+ // public void run() {
253
+ // fragment.stopRecord();
254
+ // }
255
+ // });
256
+
257
+ fragment.stopRecord();
258
+ // call.resolve();
259
+ }
260
+
261
+ @PermissionCallback
262
+ private void handleCameraPermissionResult(PluginCall call) {
263
+ if (PermissionState.GRANTED.equals(getPermissionState(CAMERA_PERMISSION_ALIAS))) {
264
+ startCamera(call);
265
+ } else {
266
+ Logger.debug(getLogTag(), "User denied camera permission: " + getPermissionState(CAMERA_PERMISSION_ALIAS).toString());
267
+ call.reject("Permission failed: user denied access to camera.");
268
+ }
269
+ }
270
+
271
+ private void startCamera(final PluginCall call) {
272
+ String position = call.getString("position");
273
+
274
+ if (position == null || position.isEmpty() || "rear".equals(position)) {
275
+ position = "back";
276
+ } else {
277
+ position = "front";
278
+ }
279
+
280
+ final Integer x = call.getInt("x", 0);
281
+ final Integer y = call.getInt("y", 0);
282
+ final Integer width = call.getInt("width", 0);
283
+ final Integer height = call.getInt("height", 0);
284
+ final Integer paddingBottom = call.getInt("paddingBottom", 0);
285
+ final Boolean toBack = call.getBoolean("toBack", false);
286
+ final Boolean storeToFile = call.getBoolean("storeToFile", false);
287
+ final Boolean enableOpacity = call.getBoolean("enableOpacity", false);
288
+ final Boolean enableZoom = call.getBoolean("enableZoom", false);
289
+ final Boolean disableExifHeaderStripping = call.getBoolean("disableExifHeaderStripping", true);
290
+ final Boolean lockOrientation = call.getBoolean("lockAndroidOrientation", false);
291
+ previousOrientationRequest = getBridge().getActivity().getRequestedOrientation();
292
+
293
+ fragment = new CameraActivity();
294
+ fragment.setEventListener(this);
295
+ fragment.defaultCamera = position;
296
+ fragment.tapToTakePicture = false;
297
+ fragment.dragEnabled = false;
298
+ fragment.tapToFocus = true;
299
+ fragment.disableExifHeaderStripping = disableExifHeaderStripping;
300
+ fragment.storeToFile = storeToFile;
301
+ fragment.toBack = toBack;
302
+ fragment.enableOpacity = enableOpacity;
303
+ fragment.enableZoom = enableZoom;
304
+
305
+ bridge
306
+ .getActivity()
307
+ .runOnUiThread(
308
+ new Runnable() {
309
+ @Override
310
+ public void run() {
311
+ DisplayMetrics metrics = getBridge().getActivity().getResources().getDisplayMetrics();
312
+ // lock orientation if specified in options:
313
+ if (lockOrientation) {
314
+ getBridge().getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
315
+ }
316
+
317
+ // offset
318
+ int computedX = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, x, metrics);
319
+ int computedY = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, y, metrics);
320
+
321
+ // size
322
+ int computedWidth;
323
+ int computedHeight;
324
+ int computedPaddingBottom;
325
+
326
+ if (paddingBottom != 0) {
327
+ computedPaddingBottom = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, paddingBottom, metrics);
328
+ } else {
329
+ computedPaddingBottom = 0;
330
+ }
331
+
332
+ if (width != 0) {
333
+ computedWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, width, metrics);
334
+ } else {
335
+ Display defaultDisplay = getBridge().getActivity().getWindowManager().getDefaultDisplay();
336
+ final Point size = new Point();
337
+ defaultDisplay.getSize(size);
338
+
339
+ computedWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size.x, metrics);
340
+ }
341
+
342
+ if (height != 0) {
343
+ computedHeight =
344
+ (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, height, metrics) - computedPaddingBottom;
345
+ } else {
346
+ Display defaultDisplay = getBridge().getActivity().getWindowManager().getDefaultDisplay();
347
+ final Point size = new Point();
348
+ defaultDisplay.getSize(size);
349
+
350
+ computedHeight =
351
+ (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size.y, metrics) - computedPaddingBottom;
352
+ }
353
+
354
+ fragment.setRect(computedX, computedY, computedWidth, computedHeight);
355
+
356
+ FrameLayout containerView = getBridge().getActivity().findViewById(containerViewId);
357
+ if (containerView == null) {
358
+ containerView = new FrameLayout(getActivity().getApplicationContext());
359
+ containerView.setId(containerViewId);
360
+
361
+ getBridge().getWebView().setBackgroundColor(Color.TRANSPARENT);
362
+ ((ViewGroup) getBridge().getWebView().getParent()).addView(containerView);
363
+ if (toBack == true) {
364
+ getBridge().getWebView().getParent().bringChildToFront(getBridge().getWebView());
365
+ setupBroadcast();
366
+ }
367
+
368
+ FragmentManager fragmentManager = getBridge().getActivity().getFragmentManager();
369
+ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
370
+ fragmentTransaction.add(containerView.getId(), fragment);
371
+ fragmentTransaction.commit();
372
+
373
+ // NOTE: we don't return invoke call.resolve here because it must be invoked in onCameraStarted
374
+ // otherwise the plugin start method might resolve/return before the camera is actually set in CameraActivity
375
+ // onResume method (see this line mCamera = Camera.open(defaultCameraId);) and the next subsequent plugin
376
+ // method invocations (for example, getSupportedFlashModes) might fails with "Camera is not running" error
377
+ // because camera is not available yet and hasCamera method will return false
378
+ // Please also see https://developer.android.com/reference/android/hardware/Camera.html#open%28int%29
379
+ bridge.saveCall(call);
380
+ cameraStartCallbackId = call.getCallbackId();
381
+ } else {
382
+ call.reject("camera already started");
383
+ }
384
+ }
385
+ }
386
+ );
387
+ }
388
+
389
+ @Override
390
+ protected void handleOnResume() {
391
+ super.handleOnResume();
392
+ }
393
+
394
+ @Override
395
+ public void onPictureTaken(String originalPicture) {
396
+ JSObject jsObject = new JSObject();
397
+ jsObject.put("value", originalPicture);
398
+ bridge.getSavedCall(captureCallbackId).resolve(jsObject);
399
+ }
400
+
401
+ @Override
402
+ public void onPictureTakenError(String message) {
403
+ bridge.getSavedCall(captureCallbackId).reject(message);
404
+ }
405
+
406
+ @Override
407
+ public void onSnapshotTaken(String originalPicture) {
408
+ JSObject jsObject = new JSObject();
409
+ jsObject.put("value", originalPicture);
410
+ bridge.getSavedCall(snapshotCallbackId).resolve(jsObject);
411
+ }
412
+
413
+ @Override
414
+ public void onSnapshotTakenError(String message) {
415
+ bridge.getSavedCall(snapshotCallbackId).reject(message);
416
+ }
417
+
418
+ @Override
419
+ public void onFocusSet(int pointX, int pointY) {}
420
+
421
+ @Override
422
+ public void onFocusSetError(String message) {}
423
+
424
+ @Override
425
+ public void onBackButton() {}
426
+
427
+ @Override
428
+ public void onCameraStarted() {
429
+ PluginCall pluginCall = bridge.getSavedCall(cameraStartCallbackId);
430
+ pluginCall.resolve();
431
+ bridge.releaseCall(pluginCall);
432
+ }
433
+
434
+ @Override
435
+ public void onStartRecordVideo() {}
436
+
437
+ @Override
438
+ public void onStartRecordVideoError(String message) {
439
+ bridge.getSavedCall(recordCallbackId).reject(message);
440
+ }
441
+
442
+ @Override
443
+ public void onStopRecordVideo(String file) {
444
+ PluginCall pluginCall = bridge.getSavedCall(recordCallbackId);
445
+ JSObject jsObject = new JSObject();
446
+ jsObject.put("videoFilePath", file);
447
+ pluginCall.resolve(jsObject);
448
+ }
449
+
450
+ @Override
451
+ public void onStopRecordVideoError(String error) {
452
+ bridge.getSavedCall(recordCallbackId).reject(error);
453
+ }
454
+
455
+ private boolean hasView(PluginCall call) {
456
+ if (fragment == null) {
457
+ return false;
458
+ }
459
+
460
+ return true;
461
+ }
462
+
463
+ private boolean hasCamera(PluginCall call) {
464
+ if (this.hasView(call) == false) {
465
+ return false;
466
+ }
467
+
468
+ if (fragment.getCamera() == null) {
469
+ return false;
470
+ }
471
+
472
+ return true;
473
+ }
474
+
475
+ private String getFilePath(String filename) {
476
+ String fileName = filename;
477
+
478
+ int i = 1;
479
+
480
+ while (new File(VIDEO_FILE_PATH + fileName + VIDEO_FILE_EXTENSION).exists()) {
481
+ // Add number suffix if file exists
482
+ fileName = filename + '_' + i;
483
+ i++;
484
+ }
485
+
486
+ return VIDEO_FILE_PATH + fileName + VIDEO_FILE_EXTENSION;
487
+ }
488
+
489
+ private void setupBroadcast() {
490
+ /** When touch event is triggered, relay it to camera view if needed so it can support pinch zoom */
491
+
492
+ getBridge().getWebView().setClickable(true);
493
+ getBridge()
494
+ .getWebView()
495
+ .setOnTouchListener(
496
+ new View.OnTouchListener() {
497
+ @Override
498
+ public boolean onTouch(View v, MotionEvent event) {
499
+ if ((null != fragment) && (fragment.toBack == true)) {
500
+ fragment.frameContainerLayout.dispatchTouchEvent(event);
501
+ }
502
+ return false;
503
+ }
504
+ }
505
+ );
506
+ }
507
+ }
@@ -0,0 +1,23 @@
1
+ package com.ahm.capacitor.camera.preview;
2
+
3
+ import android.content.Context;
4
+ import android.view.SurfaceHolder;
5
+ import android.view.SurfaceView;
6
+
7
+ class CustomSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
8
+
9
+ private final String TAG = "CustomSurfaceView";
10
+
11
+ CustomSurfaceView(Context context) {
12
+ super(context);
13
+ }
14
+
15
+ @Override
16
+ public void surfaceCreated(SurfaceHolder holder) {}
17
+
18
+ @Override
19
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
20
+
21
+ @Override
22
+ public void surfaceDestroyed(SurfaceHolder holder) {}
23
+ }
@@ -0,0 +1,29 @@
1
+ package com.ahm.capacitor.camera.preview;
2
+
3
+ import android.content.Context;
4
+ import android.graphics.SurfaceTexture;
5
+ import android.view.SurfaceHolder;
6
+ import android.view.TextureView;
7
+
8
+ class CustomTextureView extends TextureView implements TextureView.SurfaceTextureListener {
9
+
10
+ private final String TAG = "CustomTextureView";
11
+
12
+ CustomTextureView(Context context) {
13
+ super(context);
14
+ }
15
+
16
+ @Override
17
+ public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {}
18
+
19
+ @Override
20
+ public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {}
21
+
22
+ @Override
23
+ public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
24
+ return true;
25
+ }
26
+
27
+ @Override
28
+ public void onSurfaceTextureUpdated(SurfaceTexture surface) {}
29
+ }