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

πŸ—οΈ (chore): Migrate Android Camera to CameraX #87

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

asr2003
Copy link

@asr2003 asr2003 commented Jul 5, 2024

fixes #61
/claim #61

@asr2003 asr2003 changed the title Migrate Android Camera to CameraX πŸ—οΈ (chore): Migrate Android Camera to CameraX Jul 5, 2024
@riderx
Copy link
Contributor

riderx commented Jul 5, 2024

That is very nice, can you provide a video demo?

@asr2003
Copy link
Author

asr2003 commented Jul 5, 2024

@riderx Can you help me out? I am currently facing with disk ran out of space issue. So I have removed the gradle recently from by PC. I need to upgrade my PC too very soon(from current old Windows PC) and need to crack some cool bounties for it. Can you please pull this PR changes and have a look on it :). It will be grateful for me to do so.

I will incorporate any changes required further too

@asr2003
Copy link
Author

asr2003 commented Jul 6, 2024

@riderx Mostly this PR follows the recent migrations to CameraX done in the https://github.com/cocos-capital/camera-preview
I have taken this project migration as reference to do in our project

@riderx
Copy link
Contributor

riderx commented Jul 6, 2024

Hey @asr2003 thanks for the work, From what I see on the other PR on CLI.
The task didn't need Gradle to be tested, and I can see clearly it wasn't by reading the code.
Capgo code is used in production by many clients, it requires minimum quality.
I'm a solo founder, so I cannot help people doing the task I put bounty on, if I do, it's because I don't have time to work on it myself.
So I'm really sorry, but I doubt helping you is a wise use of my time.

@asr2003
Copy link
Author

asr2003 commented Jul 6, 2024

Hi @riderx,
Thank you for your feedback and for pointing out the requirements.
I apologize for the misunderstanding regarding the use of Gradle. I will review the task requirements and make the necessary adjustments to ensure the code meets the expected quality standards.
I appreciate your time and understand the constraints you mentioned. I will work independently to resolve the issues.

Thank you again for the guidance.

@riderx
Copy link
Contributor

riderx commented Jul 6, 2024

I mentioned Gradle for the CLI task, you are right here. You need it

@asr2003
Copy link
Author

asr2003 commented Jul 7, 2024

@riderx I have pulled this PR changes and downloaded the gradle in my friends PC and following the instructions given in the README.md to tests the changes: But failing with build errors:

C:\Users\91970\Desktop\algora\camera-preview>npx cap sync
[error] Could not find the web assets directory: .\www.
        Please create it and make sure it has an index.html file. You can change the path of this directory in
        capacitor.config.ts (webDir option). You may need to compile the web assets for your app (typically npm run
        build). More info: https://capacitorjs.com/docs/basics/workflow#sync-your-project

C:\Users\91970\Desktop\algora\camera-preview>npm run build

> @capgo/camera-preview@6.2.21 build
> npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs


> @capgo/camera-preview@6.2.21 clean
> rimraf ./dist


> @capgo/camera-preview@6.2.21 docgen
> docgen --api CameraPreviewPlugin --output-readme README.md --output-json dist/docs.json


DocGen Output: C:\Users\91970\Desktop\algora\camera-preview\dist\docs.json
DocGen Output: C:\Users\91970\Desktop\algora\camera-preview\README.md

node_modules/@types/node/globals.d.ts:126:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'AbortSignal' must be of type '{ new (): AbortSignal; prototype: AbortSignal; abort(reason?: any): AbortSignal; any(signals: AbortSignal[]): AbortSignal; timeout(milliseconds: number): AbortSignal; }', but here has type '{ new (): AbortSignal; prototype: AbortSignal; abort(reason?: any): AbortSignal; timeout(milliseconds: number): AbortSignal; }'.

126 declare var AbortSignal: {
                ~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:2360:13
    2360 declare var AbortSignal: {
                     ~~~~~~~~~~~
    'AbortSignal' was also declared here.

node_modules/typescript/lib/lib.dom.d.ts:23503:11 - error TS2430: Interface 'WebGL2RenderingContext' incorrectly extends interface 'WebGL2RenderingContextBase'.
  Types of property 'READ_BUFFER' are incompatible.
    Type 'number' is not assignable to type '3074'.

23503 interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase {
                ~~~~~~~~~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.dom.d.ts:23503:11 - error TS2430: Interface 'WebGL2RenderingContext' incorrectly extends interface 'WebGLRenderingContext'.
  Types of property 'RGBA8' are incompatible.
    Type 'number' is not assignable to type '32856'.

23503 interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase {
                ~~~~~~~~~~~~~~~~~~~~~~

node_modules/typescript/lib/lib.dom.d.ts:23503:11 - error TS2430: Interface 'WebGL2RenderingContext' incorrectly extends interface 'WebGLRenderingContextBase'.
  Types of property 'RGBA8' are incompatible.
    Type 'number' is not assignable to type '32856'.

23503 interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase {
                ~~~~~~~~~~~~~~~~~~~~~~

../../../node_modules/@types/webgl-ext/index.d.ts:53:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'RGBA16F_EXT' must be of type '34842', but here has type 'number'.

53  readonly RGBA16F_EXT: number;
             ~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:7642:14
    7642     readonly RGBA16F_EXT: 0x881A;
                      ~~~~~~~~~~~
    'RGBA16F_EXT' was also declared here.

../../../node_modules/@types/webgl-ext/index.d.ts:54:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'RGB16F_EXT' must be of type '34843', but here has type 'number'.

54  readonly RGB16F_EXT: number;
             ~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:7643:14
    7643     readonly RGB16F_EXT: 0x881B;
                      ~~~~~~~~~~
    'RGB16F_EXT' was also declared here.

../../../node_modules/@types/webgl-ext/index.d.ts:55:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT' must be of type '33297', but here has type 'number'.

55  readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number;
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:7644:14
    7644     readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211;
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT' was also declared here.

../../../node_modules/@types/webgl-ext/index.d.ts:56:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'UNSIGNED_NORMALIZED_EXT' must be of type '35863', but here has type 'number'.

56  readonly UNSIGNED_NORMALIZED_EXT: number;
             ~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:7645:14
    7645     readonly UNSIGNED_NORMALIZED_EXT: 0x8C17;
                      ~~~~~~~~~~~~~~~~~~~~~~~
    'UNSIGNED_NORMALIZED_EXT' was also declared here.

../../../node_modules/@types/webgl-ext/index.d.ts:74:11 - error TS2717: Subsequent property declarations must have the same type.  Property 'COMPRESSED_RGB_ETC1_WEBGL' must be of type '36196', but here has type 'number'.

74  readonly COMPRESSED_RGB_ETC1_WEBGL: number;
             ~~~~~~~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:23325:14
    23325     readonly COMPRESSED_RGB_ETC1_WEBGL: 0x8D64;
                       ~~~~~~~~~~~~~~~~~~~~~~~~~
    'COMPRESSED_RGB_ETC1_WEBGL' was also declared here.

../../../node_modules/@types/webgl2/index.d.ts:582:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'WebGL2RenderingContext' must be of type '{ new (): WebGL2RenderingContext; prototype: WebGL2RenderingContext; readonly READ_BUFFER: 3074; readonly UNPACK_ROW_LENGTH: 3314; ... 556 more ...; readonly BROWSER_DEFAULT_WEBGL: 37444; }', but here has type '{ new (): WebGL2RenderingContext; prototype: WebGL2RenderingContext; readonly ACTIVE_ATTRIBUTES: number; readonly ACTIVE_TEXTURE: number; ... 557 more ...; readonly MAX_CLIENT_WAIT_TIMEOUT_WEBGL: number; }'.

582 declare var WebGL2RenderingContext: {
                ~~~~~~~~~~~~~~~~~~~~~~

  node_modules/typescript/lib/lib.dom.d.ts:23506:13
    23506 declare var WebGL2RenderingContext: {
                      ~~~~~~~~~~~~~~~~~~~~~~
    'WebGL2RenderingContext' was also declared here.


Found 10 errors in 4 files.

Errors  Files
     1  node_modules/@types/node/globals.d.ts:126
     3  node_modules/typescript/lib/lib.dom.d.ts:23503
     5  ../../../node_modules/@types/webgl-ext/index.d.ts:53
     1  ../../../node_modules/@types/webgl2/index.d.ts:582
 

@riderx
Copy link
Contributor

riderx commented Jul 7, 2024

The instruction was for installing the plugin in one app you have already. Not to test it.
You need to go to the demo folder if you need to test

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

Successfully merging this pull request may close these issues.

Migrate Android Camera to CameraX or Camera2
2 participants