@capgo/camera-preview 5.0.0 → 5.0.2

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 (133) hide show
  1. package/README.md +22 -30
  2. package/android/.gradle/8.0.2/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/8.0.2/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/8.0.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/8.0.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/8.0.2/fileChanges/last-build.bin +0 -0
  8. package/android/.gradle/8.0.2/fileHashes/fileHashes.bin +0 -0
  9. package/android/.gradle/8.0.2/fileHashes/fileHashes.lock +0 -0
  10. package/android/.gradle/8.0.2/fileHashes/resourceHashesCache.bin +0 -0
  11. package/android/.gradle/8.0.2/gc.properties +0 -0
  12. package/android/.gradle/8.2.1/checksums/checksums.lock +0 -0
  13. package/android/.gradle/8.2.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  14. package/android/.gradle/8.2.1/dependencies-accessors/gc.properties +0 -0
  15. package/android/.gradle/8.2.1/executionHistory/executionHistory.bin +0 -0
  16. package/android/.gradle/8.2.1/executionHistory/executionHistory.lock +0 -0
  17. package/android/.gradle/8.2.1/fileChanges/last-build.bin +0 -0
  18. package/android/.gradle/8.2.1/fileHashes/fileHashes.bin +0 -0
  19. package/android/.gradle/8.2.1/fileHashes/fileHashes.lock +0 -0
  20. package/android/.gradle/8.2.1/gc.properties +0 -0
  21. package/android/.gradle/8.7/checksums/checksums.lock +0 -0
  22. package/android/.gradle/8.7/dependencies-accessors/gc.properties +0 -0
  23. package/android/.gradle/8.7/executionHistory/executionHistory.bin +0 -0
  24. package/android/.gradle/8.7/executionHistory/executionHistory.lock +0 -0
  25. package/android/.gradle/8.7/fileChanges/last-build.bin +0 -0
  26. package/android/.gradle/8.7/fileHashes/fileHashes.bin +0 -0
  27. package/android/.gradle/8.7/fileHashes/fileHashes.lock +0 -0
  28. package/android/.gradle/8.7/fileHashes/resourceHashesCache.bin +0 -0
  29. package/android/.gradle/8.7/gc.properties +0 -0
  30. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  31. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  32. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  33. package/android/.gradle/file-system.probe +0 -0
  34. package/android/.gradle/vcs-1/gc.properties +0 -0
  35. package/android/build.gradle +1 -1
  36. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  37. package/android/gradle/wrapper/gradle-wrapper.properties +1 -0
  38. package/android/gradlew +17 -12
  39. package/android/gradlew.bat +10 -10
  40. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +219 -219
  41. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +108 -85
  42. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomSurfaceView.java +4 -3
  43. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +5 -5
  44. package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +44 -23
  45. package/dist/docs.json +29 -22
  46. package/dist/esm/definitions.d.ts +6 -2
  47. package/dist/esm/definitions.js.map +1 -1
  48. package/dist/esm/index.d.ts +2 -2
  49. package/dist/esm/index.js +4 -4
  50. package/dist/esm/index.js.map +1 -1
  51. package/dist/esm/web.d.ts +2 -2
  52. package/dist/esm/web.js +44 -45
  53. package/dist/esm/web.js.map +1 -1
  54. package/dist/plugin.cjs.js +45 -46
  55. package/dist/plugin.cjs.js.map +1 -1
  56. package/dist/plugin.js +45 -46
  57. package/dist/plugin.js.map +1 -1
  58. package/ios/Plugin/CameraController.swift +35 -14
  59. package/ios/Plugin/Plugin.swift +25 -26
  60. package/ios/Plugin.xcodeproj/xcuserdata/martindonadieu.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  61. package/ios/Plugin.xcworkspace/xcuserdata/martindonadieu.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  62. package/ios/PluginTests/PluginTests.swift +61 -13
  63. package/ios/Podfile.lock +3 -3
  64. package/ios/Pods/CapacitorCordova/LICENSE +23 -0
  65. package/ios/Pods/CapacitorCordova/README.md +39 -0
  66. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +21 -0
  67. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +8 -0
  68. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +5 -0
  69. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +28 -0
  70. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +109 -0
  71. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +51 -0
  72. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +39 -0
  73. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +154 -0
  74. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +31 -0
  75. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +81 -0
  76. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +52 -0
  77. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +116 -0
  78. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +81 -0
  79. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +154 -0
  80. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +25 -0
  81. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +77 -0
  82. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +82 -0
  83. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +216 -0
  84. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
  85. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.h +41 -0
  86. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.m +399 -0
  87. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +27 -0
  88. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +74 -0
  89. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.h +27 -0
  90. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.m +156 -0
  91. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +30 -0
  92. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +34 -0
  93. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
  94. package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
  95. package/ios/Pods/Local Podspecs/Capacitor.podspec.json +31 -0
  96. package/ios/Pods/Manifest.lock +23 -0
  97. package/ios/Pods/Pods.xcodeproj/project.pbxproj +1489 -0
  98. package/ios/Pods/Pods.xcodeproj/xcuserdata/martindonadieu.xcuserdatad/xcschemes/Capacitor.xcscheme +58 -0
  99. package/ios/Pods/Pods.xcodeproj/xcuserdata/martindonadieu.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +58 -0
  100. package/ios/Pods/Pods.xcodeproj/xcuserdata/martindonadieu.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +58 -0
  101. package/ios/Pods/Pods.xcodeproj/xcuserdata/martindonadieu.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +58 -0
  102. package/ios/Pods/Pods.xcodeproj/xcuserdata/martindonadieu.xcuserdatad/xcschemes/xcschememanagement.plist +39 -0
  103. package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +26 -0
  104. package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +5 -0
  105. package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +12 -0
  106. package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +16 -0
  107. package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +8 -0
  108. package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +16 -0
  109. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +26 -0
  110. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +5 -0
  111. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +12 -0
  112. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h +32 -0
  113. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +13 -0
  114. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +6 -0
  115. package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +13 -0
  116. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +26 -0
  117. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +55 -0
  118. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +93 -0
  119. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +5 -0
  120. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +16 -0
  121. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +14 -0
  122. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +6 -0
  123. package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +14 -0
  124. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +26 -0
  125. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +55 -0
  126. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +93 -0
  127. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +5 -0
  128. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +188 -0
  129. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +16 -0
  130. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +15 -0
  131. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +6 -0
  132. package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +15 -0
  133. package/package.json +41 -48
@@ -2,15 +2,15 @@
2
2
 
3
3
  var core = require('@capacitor/core');
4
4
 
5
- const CameraPreview = core.registerPlugin("CameraPreview", {
6
- web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CameraPreviewWeb()),
5
+ const CameraPreview = core.registerPlugin('CameraPreview', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CameraPreviewWeb()),
7
7
  });
8
8
 
9
9
  class CameraPreviewWeb extends core.WebPlugin {
10
10
  constructor() {
11
11
  super({
12
- name: "CameraPreview",
13
- platforms: ["web"],
12
+ name: 'CameraPreview',
13
+ platforms: ['web'],
14
14
  });
15
15
  }
16
16
  async start(options) {
@@ -22,30 +22,30 @@ class CameraPreviewWeb extends core.WebPlugin {
22
22
  })
23
23
  .then((stream) => {
24
24
  // Stop any existing stream so we can request media with different constraints based on user input
25
- stream.getTracks().forEach((track) => track.stop());
25
+ stream.getTracks().forEach(track => track.stop());
26
26
  })
27
27
  .catch((error) => {
28
28
  Promise.reject(error);
29
29
  });
30
- const video = document.getElementById("video");
30
+ const video = document.getElementById('video');
31
31
  const parent = document.getElementById(options.parent);
32
32
  if (!video) {
33
- const videoElement = document.createElement("video");
34
- videoElement.id = "video";
35
- videoElement.setAttribute("class", options.className || "");
33
+ const videoElement = document.createElement('video');
34
+ videoElement.id = 'video';
35
+ videoElement.setAttribute('class', options.className || '');
36
36
  // Don't flip video feed if camera is rear facing
37
- if (options.position !== "rear") {
38
- videoElement.setAttribute("style", "-webkit-transform: scaleX(-1); transform: scaleX(-1);");
37
+ if (options.position !== 'rear') {
38
+ videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');
39
39
  }
40
40
  const userAgent = navigator.userAgent.toLowerCase();
41
- const isSafari = userAgent.includes("safari") && !userAgent.includes("chrome");
41
+ const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
42
42
  // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful
43
43
  // Without these attributes videoElement.play() will throw a NotAllowedError
44
44
  // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari
45
45
  if (isSafari) {
46
- videoElement.setAttribute("autoplay", "true");
47
- videoElement.setAttribute("muted", "true");
48
- videoElement.setAttribute("playsinline", "true");
46
+ videoElement.setAttribute('autoplay', 'true');
47
+ videoElement.setAttribute('muted', 'true');
48
+ videoElement.setAttribute('playsinline', 'true');
49
49
  }
50
50
  parent.appendChild(videoElement);
51
51
  if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {
@@ -55,45 +55,45 @@ class CameraPreviewWeb extends core.WebPlugin {
55
55
  height: { ideal: options.height },
56
56
  },
57
57
  };
58
- if (options.position === "rear") {
59
- constraints.video.facingMode =
60
- "environment";
58
+ if (options.position === 'rear') {
59
+ constraints.video.facingMode
60
+ = 'environment';
61
61
  this.isBackCamera = true;
62
62
  }
63
63
  else {
64
64
  this.isBackCamera = false;
65
65
  }
66
+ // eslint-disable-next-line ts/no-this-alias
66
67
  const self = this;
67
- await navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
68
- if (document.getElementById("video")) {
69
- //video.src = window.URL.createObjectURL(stream);
68
+ await navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
69
+ if (document.getElementById('video')) {
70
+ // video.src = window.URL.createObjectURL(stream);
70
71
  videoElement.srcObject = stream;
71
72
  videoElement.play();
72
73
  Promise.resolve({});
73
74
  }
74
75
  else {
75
76
  self.stopStream(stream);
76
- Promise.reject({ message: "camera already stopped" });
77
+ Promise.reject(new Error('camera already stopped'));
77
78
  }
78
79
  }, (err) => {
79
- Promise.reject(err);
80
+ Promise.reject(new Error(err));
80
81
  });
81
82
  }
82
83
  }
83
84
  else {
84
- Promise.reject({ message: "camera already started" });
85
+ Promise.reject(new Error('camera already started'));
85
86
  }
86
87
  }
87
88
  stopStream(stream) {
88
89
  if (stream) {
89
90
  const tracks = stream.getTracks();
90
- for (const track of tracks) {
91
+ for (const track of tracks)
91
92
  track.stop();
92
- }
93
93
  }
94
94
  }
95
95
  async stop() {
96
- const video = document.getElementById("video");
96
+ const video = document.getElementById('video');
97
97
  if (video) {
98
98
  video.pause();
99
99
  this.stopStream(video.srcObject);
@@ -102,16 +102,16 @@ class CameraPreviewWeb extends core.WebPlugin {
102
102
  }
103
103
  async capture(options) {
104
104
  return new Promise((resolve, reject) => {
105
- const video = document.getElementById("video");
105
+ const video = document.getElementById('video');
106
106
  if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {
107
- reject({ message: "camera is not running" });
107
+ reject(new Error('camera is not running'));
108
108
  return;
109
109
  }
110
110
  // video.width = video.offsetWidth;
111
111
  let base64EncodedImage;
112
112
  if (video && video.videoWidth > 0 && video.videoHeight > 0) {
113
- const canvas = document.createElement("canvas");
114
- const context = canvas.getContext("2d");
113
+ const canvas = document.createElement('canvas');
114
+ const context = canvas.getContext('2d');
115
115
  canvas.width = video.videoWidth;
116
116
  canvas.height = video.videoHeight;
117
117
  // flip horizontally back camera isn't used
@@ -120,15 +120,15 @@ class CameraPreviewWeb extends core.WebPlugin {
120
120
  context.scale(-1, 1);
121
121
  }
122
122
  context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
123
- if ((options.format || "jpeg") === "jpeg") {
123
+ if ((options.format || 'jpeg') === 'jpeg') {
124
124
  base64EncodedImage = canvas
125
- .toDataURL("image/jpeg", (options.quality || 85) / 100.0)
126
- .replace("data:image/jpeg;base64,", "");
125
+ .toDataURL('image/jpeg', (options.quality || 85) / 100.0)
126
+ .replace('data:image/jpeg;base64,', '');
127
127
  }
128
128
  else {
129
129
  base64EncodedImage = canvas
130
- .toDataURL("image/png")
131
- .replace("data:image/png;base64,", "");
130
+ .toDataURL('image/png')
131
+ .replace('data:image/png;base64,', '');
132
132
  }
133
133
  }
134
134
  resolve({
@@ -140,28 +140,27 @@ class CameraPreviewWeb extends core.WebPlugin {
140
140
  return this.capture(_options);
141
141
  }
142
142
  async stopRecordVideo() {
143
- throw new Error("stopRecordVideo not supported under the web platform");
143
+ throw new Error('stopRecordVideo not supported under the web platform');
144
144
  }
145
145
  async startRecordVideo(_options) {
146
- throw new Error("startRecordVideo not supported under the web platform");
146
+ throw new Error('startRecordVideo not supported under the web platform');
147
147
  }
148
148
  async getSupportedFlashModes() {
149
- throw new Error("getSupportedFlashModes not supported under the web platform");
149
+ throw new Error('getSupportedFlashModes not supported under the web platform');
150
150
  }
151
151
  async getHorizontalFov() {
152
- throw new Error("getHorizontalFov not supported under the web platform");
152
+ throw new Error('getHorizontalFov not supported under the web platform');
153
153
  }
154
154
  async setFlashMode(_options) {
155
- throw new Error("setFlashMode not supported under the web platform" + _options);
155
+ throw new Error(`setFlashMode not supported under the web platform${_options}`);
156
156
  }
157
157
  async flip() {
158
- throw new Error("flip not supported under the web platform");
158
+ throw new Error('flip not supported under the web platform');
159
159
  }
160
160
  async setOpacity(_options) {
161
- const video = document.getElementById("video");
162
- if (!!video && !!_options["opacity"]) {
163
- video.style.setProperty("opacity", _options["opacity"].toString());
164
- }
161
+ const video = document.getElementById('video');
162
+ if (!!video && !!_options.opacity)
163
+ video.style.setProperty('opacity', _options.opacity.toString());
165
164
  }
166
165
  }
167
166
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CameraPreview = registerPlugin(\"CameraPreview\", {\n web: () => import(\"./web\").then((m) => new m.CameraPreviewWeb()),\n});\nexport * from \"./definitions\";\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: \"CameraPreview\",\n platforms: [\"web\"],\n });\n }\n async start(options) {\n var _a;\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach((track) => track.stop());\n })\n .catch((error) => {\n Promise.reject(error);\n });\n const video = document.getElementById(\"video\");\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement(\"video\");\n videoElement.id = \"video\";\n videoElement.setAttribute(\"class\", options.className || \"\");\n // Don't flip video feed if camera is rear facing\n if (options.position !== \"rear\") {\n videoElement.setAttribute(\"style\", \"-webkit-transform: scaleX(-1); transform: scaleX(-1);\");\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes(\"safari\") && !userAgent.includes(\"chrome\");\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute(\"autoplay\", \"true\");\n videoElement.setAttribute(\"muted\", \"true\");\n videoElement.setAttribute(\"playsinline\", \"true\");\n }\n parent.appendChild(videoElement);\n if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === \"rear\") {\n constraints.video.facingMode =\n \"environment\";\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n const self = this;\n await navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {\n if (document.getElementById(\"video\")) {\n //video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n Promise.resolve({});\n }\n else {\n self.stopStream(stream);\n Promise.reject({ message: \"camera already stopped\" });\n }\n }, (err) => {\n Promise.reject(err);\n });\n }\n }\n else {\n Promise.reject({ message: \"camera already started\" });\n }\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks) {\n track.stop();\n }\n }\n }\n async stop() {\n const video = document.getElementById(\"video\");\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(\"video\");\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject({ message: \"camera is not running\" });\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n }\n else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n async startRecordVideo(_options) {\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n async getSupportedFlashModes() {\n throw new Error(\"getSupportedFlashModes not supported under the web platform\");\n }\n async getHorizontalFov() {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n async setFlashMode(_options) {\n throw new Error(\"setFlashMode not supported under the web platform\" + _options);\n }\n async flip() {\n throw new Error(\"flip not supported under the web platform\");\n }\n async setOpacity(_options) {\n const video = document.getElementById(\"video\");\n if (!!video && !!_options[\"opacity\"]) {\n video.style.setProperty(\"opacity\", _options[\"opacity\"].toString());\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,gBAAgB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;AACjF,KAAK;AACL,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,mDAAmD,GAAG,QAAQ,CAAC,CAAC;AACxF,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;AACrE,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;AAC9C,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC/E,SAAS;AACT,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CameraPreview = registerPlugin('CameraPreview', {\n web: () => import('./web').then(m => new m.CameraPreviewWeb()),\n});\nexport * from './definitions';\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: 'CameraPreview',\n platforms: ['web'],\n });\n }\n async start(options) {\n var _a;\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach(track => track.stop());\n })\n .catch((error) => {\n Promise.reject(error);\n });\n const video = document.getElementById('video');\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement('video');\n videoElement.id = 'video';\n videoElement.setAttribute('class', options.className || '');\n // Don't flip video feed if camera is rear facing\n if (options.position !== 'rear') {\n videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute('autoplay', 'true');\n videoElement.setAttribute('muted', 'true');\n videoElement.setAttribute('playsinline', 'true');\n }\n parent.appendChild(videoElement);\n if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === 'rear') {\n constraints.video.facingMode\n = 'environment';\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n // eslint-disable-next-line ts/no-this-alias\n const self = this;\n await navigator.mediaDevices.getUserMedia(constraints).then((stream) => {\n if (document.getElementById('video')) {\n // video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n Promise.resolve({});\n }\n else {\n self.stopStream(stream);\n Promise.reject(new Error('camera already stopped'));\n }\n }, (err) => {\n Promise.reject(new Error(err));\n });\n }\n }\n else {\n Promise.reject(new Error('camera already started'));\n }\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks)\n track.stop();\n }\n }\n async stop() {\n const video = document.getElementById('video');\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById('video');\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject(new Error('camera is not running'));\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if ((options.format || 'jpeg') === 'jpeg') {\n base64EncodedImage = canvas\n .toDataURL('image/jpeg', (options.quality || 85) / 100.0)\n .replace('data:image/jpeg;base64,', '');\n }\n else {\n base64EncodedImage = canvas\n .toDataURL('image/png')\n .replace('data:image/png;base64,', '');\n }\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error('stopRecordVideo not supported under the web platform');\n }\n async startRecordVideo(_options) {\n throw new Error('startRecordVideo not supported under the web platform');\n }\n async getSupportedFlashModes() {\n throw new Error('getSupportedFlashModes not supported under the web platform');\n }\n async getHorizontalFov() {\n throw new Error('getHorizontalFov not supported under the web platform');\n }\n async setFlashMode(_options) {\n throw new Error(`setFlashMode not supported under the web platform${_options}`);\n }\n async flip() {\n throw new Error('flip not supported under the web platform');\n }\n async setOpacity(_options) {\n const video = document.getElementById('video');\n if (!!video && !!_options.opacity)\n video.style.setProperty('opacity', _options.opacity.toString());\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,SAAS,EAAE,CAAC,KAAK,CAAC;AAC9B,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,MAAM,KAAK,CAA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,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;AACrE,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO;AACzC,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC5E,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var capacitorApp = (function (exports, core) {
2
2
  'use strict';
3
3
 
4
- const CameraPreview = core.registerPlugin("CameraPreview", {
5
- web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CameraPreviewWeb()),
4
+ const CameraPreview = core.registerPlugin('CameraPreview', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CameraPreviewWeb()),
6
6
  });
7
7
 
8
8
  class CameraPreviewWeb extends core.WebPlugin {
9
9
  constructor() {
10
10
  super({
11
- name: "CameraPreview",
12
- platforms: ["web"],
11
+ name: 'CameraPreview',
12
+ platforms: ['web'],
13
13
  });
14
14
  }
15
15
  async start(options) {
@@ -21,30 +21,30 @@ var capacitorApp = (function (exports, core) {
21
21
  })
22
22
  .then((stream) => {
23
23
  // Stop any existing stream so we can request media with different constraints based on user input
24
- stream.getTracks().forEach((track) => track.stop());
24
+ stream.getTracks().forEach(track => track.stop());
25
25
  })
26
26
  .catch((error) => {
27
27
  Promise.reject(error);
28
28
  });
29
- const video = document.getElementById("video");
29
+ const video = document.getElementById('video');
30
30
  const parent = document.getElementById(options.parent);
31
31
  if (!video) {
32
- const videoElement = document.createElement("video");
33
- videoElement.id = "video";
34
- videoElement.setAttribute("class", options.className || "");
32
+ const videoElement = document.createElement('video');
33
+ videoElement.id = 'video';
34
+ videoElement.setAttribute('class', options.className || '');
35
35
  // Don't flip video feed if camera is rear facing
36
- if (options.position !== "rear") {
37
- videoElement.setAttribute("style", "-webkit-transform: scaleX(-1); transform: scaleX(-1);");
36
+ if (options.position !== 'rear') {
37
+ videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');
38
38
  }
39
39
  const userAgent = navigator.userAgent.toLowerCase();
40
- const isSafari = userAgent.includes("safari") && !userAgent.includes("chrome");
40
+ const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
41
41
  // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful
42
42
  // Without these attributes videoElement.play() will throw a NotAllowedError
43
43
  // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari
44
44
  if (isSafari) {
45
- videoElement.setAttribute("autoplay", "true");
46
- videoElement.setAttribute("muted", "true");
47
- videoElement.setAttribute("playsinline", "true");
45
+ videoElement.setAttribute('autoplay', 'true');
46
+ videoElement.setAttribute('muted', 'true');
47
+ videoElement.setAttribute('playsinline', 'true');
48
48
  }
49
49
  parent.appendChild(videoElement);
50
50
  if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {
@@ -54,45 +54,45 @@ var capacitorApp = (function (exports, core) {
54
54
  height: { ideal: options.height },
55
55
  },
56
56
  };
57
- if (options.position === "rear") {
58
- constraints.video.facingMode =
59
- "environment";
57
+ if (options.position === 'rear') {
58
+ constraints.video.facingMode
59
+ = 'environment';
60
60
  this.isBackCamera = true;
61
61
  }
62
62
  else {
63
63
  this.isBackCamera = false;
64
64
  }
65
+ // eslint-disable-next-line ts/no-this-alias
65
66
  const self = this;
66
- await navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
67
- if (document.getElementById("video")) {
68
- //video.src = window.URL.createObjectURL(stream);
67
+ await navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
68
+ if (document.getElementById('video')) {
69
+ // video.src = window.URL.createObjectURL(stream);
69
70
  videoElement.srcObject = stream;
70
71
  videoElement.play();
71
72
  Promise.resolve({});
72
73
  }
73
74
  else {
74
75
  self.stopStream(stream);
75
- Promise.reject({ message: "camera already stopped" });
76
+ Promise.reject(new Error('camera already stopped'));
76
77
  }
77
78
  }, (err) => {
78
- Promise.reject(err);
79
+ Promise.reject(new Error(err));
79
80
  });
80
81
  }
81
82
  }
82
83
  else {
83
- Promise.reject({ message: "camera already started" });
84
+ Promise.reject(new Error('camera already started'));
84
85
  }
85
86
  }
86
87
  stopStream(stream) {
87
88
  if (stream) {
88
89
  const tracks = stream.getTracks();
89
- for (const track of tracks) {
90
+ for (const track of tracks)
90
91
  track.stop();
91
- }
92
92
  }
93
93
  }
94
94
  async stop() {
95
- const video = document.getElementById("video");
95
+ const video = document.getElementById('video');
96
96
  if (video) {
97
97
  video.pause();
98
98
  this.stopStream(video.srcObject);
@@ -101,16 +101,16 @@ var capacitorApp = (function (exports, core) {
101
101
  }
102
102
  async capture(options) {
103
103
  return new Promise((resolve, reject) => {
104
- const video = document.getElementById("video");
104
+ const video = document.getElementById('video');
105
105
  if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {
106
- reject({ message: "camera is not running" });
106
+ reject(new Error('camera is not running'));
107
107
  return;
108
108
  }
109
109
  // video.width = video.offsetWidth;
110
110
  let base64EncodedImage;
111
111
  if (video && video.videoWidth > 0 && video.videoHeight > 0) {
112
- const canvas = document.createElement("canvas");
113
- const context = canvas.getContext("2d");
112
+ const canvas = document.createElement('canvas');
113
+ const context = canvas.getContext('2d');
114
114
  canvas.width = video.videoWidth;
115
115
  canvas.height = video.videoHeight;
116
116
  // flip horizontally back camera isn't used
@@ -119,15 +119,15 @@ var capacitorApp = (function (exports, core) {
119
119
  context.scale(-1, 1);
120
120
  }
121
121
  context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
122
- if ((options.format || "jpeg") === "jpeg") {
122
+ if ((options.format || 'jpeg') === 'jpeg') {
123
123
  base64EncodedImage = canvas
124
- .toDataURL("image/jpeg", (options.quality || 85) / 100.0)
125
- .replace("data:image/jpeg;base64,", "");
124
+ .toDataURL('image/jpeg', (options.quality || 85) / 100.0)
125
+ .replace('data:image/jpeg;base64,', '');
126
126
  }
127
127
  else {
128
128
  base64EncodedImage = canvas
129
- .toDataURL("image/png")
130
- .replace("data:image/png;base64,", "");
129
+ .toDataURL('image/png')
130
+ .replace('data:image/png;base64,', '');
131
131
  }
132
132
  }
133
133
  resolve({
@@ -139,28 +139,27 @@ var capacitorApp = (function (exports, core) {
139
139
  return this.capture(_options);
140
140
  }
141
141
  async stopRecordVideo() {
142
- throw new Error("stopRecordVideo not supported under the web platform");
142
+ throw new Error('stopRecordVideo not supported under the web platform');
143
143
  }
144
144
  async startRecordVideo(_options) {
145
- throw new Error("startRecordVideo not supported under the web platform");
145
+ throw new Error('startRecordVideo not supported under the web platform');
146
146
  }
147
147
  async getSupportedFlashModes() {
148
- throw new Error("getSupportedFlashModes not supported under the web platform");
148
+ throw new Error('getSupportedFlashModes not supported under the web platform');
149
149
  }
150
150
  async getHorizontalFov() {
151
- throw new Error("getHorizontalFov not supported under the web platform");
151
+ throw new Error('getHorizontalFov not supported under the web platform');
152
152
  }
153
153
  async setFlashMode(_options) {
154
- throw new Error("setFlashMode not supported under the web platform" + _options);
154
+ throw new Error(`setFlashMode not supported under the web platform${_options}`);
155
155
  }
156
156
  async flip() {
157
- throw new Error("flip not supported under the web platform");
157
+ throw new Error('flip not supported under the web platform');
158
158
  }
159
159
  async setOpacity(_options) {
160
- const video = document.getElementById("video");
161
- if (!!video && !!_options["opacity"]) {
162
- video.style.setProperty("opacity", _options["opacity"].toString());
163
- }
160
+ const video = document.getElementById('video');
161
+ if (!!video && !!_options.opacity)
162
+ video.style.setProperty('opacity', _options.opacity.toString());
164
163
  }
165
164
  }
166
165
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CameraPreview = registerPlugin(\"CameraPreview\", {\n web: () => import(\"./web\").then((m) => new m.CameraPreviewWeb()),\n});\nexport * from \"./definitions\";\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: \"CameraPreview\",\n platforms: [\"web\"],\n });\n }\n async start(options) {\n var _a;\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach((track) => track.stop());\n })\n .catch((error) => {\n Promise.reject(error);\n });\n const video = document.getElementById(\"video\");\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement(\"video\");\n videoElement.id = \"video\";\n videoElement.setAttribute(\"class\", options.className || \"\");\n // Don't flip video feed if camera is rear facing\n if (options.position !== \"rear\") {\n videoElement.setAttribute(\"style\", \"-webkit-transform: scaleX(-1); transform: scaleX(-1);\");\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes(\"safari\") && !userAgent.includes(\"chrome\");\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute(\"autoplay\", \"true\");\n videoElement.setAttribute(\"muted\", \"true\");\n videoElement.setAttribute(\"playsinline\", \"true\");\n }\n parent.appendChild(videoElement);\n if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === \"rear\") {\n constraints.video.facingMode =\n \"environment\";\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n const self = this;\n await navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {\n if (document.getElementById(\"video\")) {\n //video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n Promise.resolve({});\n }\n else {\n self.stopStream(stream);\n Promise.reject({ message: \"camera already stopped\" });\n }\n }, (err) => {\n Promise.reject(err);\n });\n }\n }\n else {\n Promise.reject({ message: \"camera already started\" });\n }\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks) {\n track.stop();\n }\n }\n }\n async stop() {\n const video = document.getElementById(\"video\");\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(\"video\");\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject({ message: \"camera is not running\" });\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n }\n else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n async startRecordVideo(_options) {\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n async getSupportedFlashModes() {\n throw new Error(\"getSupportedFlashModes not supported under the web platform\");\n }\n async getHorizontalFov() {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n async setFlashMode(_options) {\n throw new Error(\"setFlashMode not supported under the web platform\" + _options);\n }\n async flip() {\n throw new Error(\"flip not supported under the web platform\");\n }\n async setOpacity(_options) {\n const video = document.getElementById(\"video\");\n if (!!video && !!_options[\"opacity\"]) {\n video.style.setProperty(\"opacity\", _options[\"opacity\"].toString());\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC;IACd,YAAY,IAAI,EAAE,eAAe;IACjC,YAAY,SAAS,EAAE,CAAC,KAAK,CAAC;IAC9B,SAAS,CAAC,CAAC;IACX,KAAK;IACL,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;IACzB,QAAQ,IAAI,EAAE,CAAC;IACf,QAAQ,MAAM,SAAS,CAAC,YAAY;IACpC,aAAa,YAAY,CAAC;IAC1B,YAAY,KAAK,EAAE,CAAC,OAAO,CAAC,YAAY;IACxC,YAAY,KAAK,EAAE,IAAI;IACvB,SAAS,CAAC;IACV,aAAa,IAAI,CAAC,CAAC,MAAM,KAAK;IAC9B;IACA,YAAY,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAChE,SAAS,CAAC;IACV,aAAa,KAAK,CAAC,CAAC,KAAK,KAAK;IAC9B,YAAY,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,SAAS,CAAC,CAAC;IACX,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,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AAE;IAClC,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,KAAK;IACL,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAChF,KAAK;IACL,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACjF,KAAK;IACL,IAAI,MAAM,sBAAsB,GAAG;IACnC,QAAQ,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACvF,KAAK;IACL,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACjF,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,mDAAmD,GAAG,QAAQ,CAAC,CAAC;IACxF,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACrE,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;IAC9C,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/E,SAAS;IACT,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CameraPreview = registerPlugin('CameraPreview', {\n web: () => import('./web').then(m => new m.CameraPreviewWeb()),\n});\nexport * from './definitions';\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: 'CameraPreview',\n platforms: ['web'],\n });\n }\n async start(options) {\n var _a;\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach(track => track.stop());\n })\n .catch((error) => {\n Promise.reject(error);\n });\n const video = document.getElementById('video');\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement('video');\n videoElement.id = 'video';\n videoElement.setAttribute('class', options.className || '');\n // Don't flip video feed if camera is rear facing\n if (options.position !== 'rear') {\n videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute('autoplay', 'true');\n videoElement.setAttribute('muted', 'true');\n videoElement.setAttribute('playsinline', 'true');\n }\n parent.appendChild(videoElement);\n if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === 'rear') {\n constraints.video.facingMode\n = 'environment';\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n // eslint-disable-next-line ts/no-this-alias\n const self = this;\n await navigator.mediaDevices.getUserMedia(constraints).then((stream) => {\n if (document.getElementById('video')) {\n // video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n Promise.resolve({});\n }\n else {\n self.stopStream(stream);\n Promise.reject(new Error('camera already stopped'));\n }\n }, (err) => {\n Promise.reject(new Error(err));\n });\n }\n }\n else {\n Promise.reject(new Error('camera already started'));\n }\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks)\n track.stop();\n }\n }\n async stop() {\n const video = document.getElementById('video');\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById('video');\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject(new Error('camera is not running'));\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if ((options.format || 'jpeg') === 'jpeg') {\n base64EncodedImage = canvas\n .toDataURL('image/jpeg', (options.quality || 85) / 100.0)\n .replace('data:image/jpeg;base64,', '');\n }\n else {\n base64EncodedImage = canvas\n .toDataURL('image/png')\n .replace('data:image/png;base64,', '');\n }\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error('stopRecordVideo not supported under the web platform');\n }\n async startRecordVideo(_options) {\n throw new Error('startRecordVideo not supported under the web platform');\n }\n async getSupportedFlashModes() {\n throw new Error('getSupportedFlashModes not supported under the web platform');\n }\n async getHorizontalFov() {\n throw new Error('getHorizontalFov not supported under the web platform');\n }\n async setFlashMode(_options) {\n throw new Error(`setFlashMode not supported under the web platform${_options}`);\n }\n async flip() {\n throw new Error('flip not supported under the web platform');\n }\n async setOpacity(_options) {\n const video = document.getElementById('video');\n if (!!video && !!_options.opacity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