cordova-rtc / cordova-plugin-iosrtc

Cordova iOS plugin exposing the WebRTC W3C API
MIT License
688 stars 340 forks source link

Build Failed #776

Closed aks7665 closed 1 year ago

aks7665 commented 1 year ago

YOU MUST read first!

Please use Community Forum for general technical discussions and questions.

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed, removing this checkbox will result in automatic closed issue.

Versions affected

Description

I am not able to create the build after adding plugin to my project. Build just get failed with errors.

Getting following errors:

Screenshot 2023-09-01 at 4 15 30 PM Screenshot 2023-09-01 at 4 13 05 PM

When run the build command in terminal gets the following error:

ld: warning: Could not find or use auto-linked framework 'WebRTC' Undefined symbols for architecture arm64: "_OBJCCLASS$_RTCAudioSessionConfiguration", referenced from: objc-class-ref in PluginRTCAudioController.o "_OBJCCLASS$_RTCAudioTrack", referenced from: objc-class-ref in iosrtcPlugin.o objc-class-ref in PluginMediaStream.o objc-class-ref in PluginMediaStreamRenderer.o "_OBJCCLASS$_RTCCameraVideoCapturer", referenced from: objc-class-ref in PluginRTCVideoCaptureController.o "_OBJCCLASS$_RTCConfiguration", referenced from: objc-class-ref in PluginRTCPeerConnectionConfig.o "_OBJCCLASS$_RTCDataBuffer", referenced from: objc-class-ref in PluginRTCDataChannel.o "_OBJCCLASS$_RTCDataChannelConfiguration", referenced from: objc-class-ref in PluginRTCDataChannel.o "_OBJCCLASS$_RTCDefaultVideoDecoderFactory", referenced from: objc-class-ref in iosrtcPlugin.o "_OBJCCLASS$_RTCDefaultVideoEncoderFactory", referenced from: objc-class-ref in iosrtcPlugin.o "_OBJCCLASS$_RTCEAGLVideoView", referenced from: objc-class-ref in PluginMediaStreamRenderer.o "_OBJCCLASS$_RTCIceCandidate", referenced from: objc-class-ref in PluginRTCPeerConnection.o "_OBJCCLASS$_RTCIceServer", referenced from: objc-class-ref in PluginRTCPeerConnectionConfig.o "_OBJCCLASS$_RTCLegacyStatsReport", referenced from: objc-class-ref in PluginRTCPeerConnection.o "_OBJCCLASS$_RTCMediaConstraints", referenced from: objc-class-ref in PluginRTCPeerConnectionConstraints.o "_OBJCCLASS$_RTCMediaStream", referenced from: objc-class-ref in PluginRTCPeerConnection.o "_OBJCCLASS$_RTCMediaStreamTrack", referenced from: objc-class-ref in PluginMediaStream.o "_OBJCCLASS$_RTCPeerConnectionFactory", referenced from: objc-class-ref in iosrtcPlugin.o "_OBJCCLASS$_RTCRtpCodecParameters", referenced from: objc-class-ref in PluginRTCRtpSender.o objc-class-ref in PluginRTCRtpParameters.o "_OBJCCLASS$_RTCRtpEncodingParameters", referenced from: objc-class-ref in PluginRTCRtpTransceiver.o objc-class-ref in PluginRTCRtpSender.o objc-class-ref in PluginRTCRtpParameters.o "_OBJCCLASS$_RTCRtpParameters", referenced from: objc-class-ref in PluginRTCRtpSender.o "_OBJCCLASS$_RTCRtpSender", referenced from: objc-class-ref in PluginRTCDTMFSender.o "_OBJCCLASS$_RTCRtpTransceiver", referenced from: objc-class-ref in PluginRTCPeerConnection.o "_OBJCCLASS$_RTCRtpTransceiverInit", referenced from: objc-class-ref in PluginRTCRtpTransceiver.o "_OBJCCLASS$_RTCSessionDescription", referenced from: objc-class-ref in PluginRTCPeerConnection.o "_OBJCCLASS$_RTCVideoCodecInfo", referenced from: objc-class-ref in iosrtcPlugin.o "_OBJCCLASS$_RTCVideoTrack", referenced from: objc-class-ref in iosrtcPlugin.o objc-class-ref in PluginMediaStream.o objc-class-ref in PluginMediaStreamRenderer.o "RTCInitializeSSL", referenced from: $s10HelloWorld12iosrtcPluginC16pluginInitializeyyF in iosrtcPlugin.o "kRTCH264CodecName", referenced from: $s10HelloWorld12iosrtcPluginC25initPeerConnectionFactory33_CB77B952428965CE768DEE0605543B37LLyyF in iosrtcPlugin.o "kRTCVp8CodecName", referenced from: $s10HelloWorld12iosrtcPluginC25initPeerConnectionFactory33_CB77B952428965CE768DEE0605543B37LLyyF in iosrtcPlugin.o "kRTCVp9CodecName", referenced from: $s10HelloWorld12iosrtcPluginC25initPeerConnectionFactory33_CB77B952428965CE768DEE0605543B37LLyyF in iosrtcPlugin.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

warning: Run script build phase 'Copy www directory' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'HelloWorld' from project 'HelloWorld') BUILD FAILED

The following build commands failed: Ld /Users/amitsharma/Development/hello/platforms/ios/build/emulator/HelloWorld.app/HelloWorld normal (in target 'HelloWorld' from project 'HelloWorld') (1 failure) xcodebuild: Command failed with exit code 65

Steps to reproduce

After installing the plugin. I run "cordova build ios" and while building the app throws error. Same is happening when tries to run app from the Xcode.

Expected results

Build success.

Actual results

Build failing

aks7665 commented 1 year ago

Found out the solution. Need to use rosetta emulator. Just change the settings of Xcode. Product -> Destination -> Destination Architectures -> Select (Show Both)

After that while building the app select rosetta emulator device. For eg. iPhone 14 (rosetta)

hthetiot commented 1 year ago

Thx @aks7665 for leaving solution and closing the issue.

aks7665 commented 1 year ago

@hthetiot Hi,

I am facing one more issue. How can I hide/remove the native UIView element. It keeps displaying even after all the tracks are stop. It shows a black screen on the place of video.

hthetiot commented 1 year ago

The video will be removed once the video tag is removed. The Black is the video itself.

See also:

aks7665 commented 1 year ago

@hthetiot I think the issue is related to something else. I am getting a error message in the app: event must have a valid type property. And it is in file Cordova-plugin-iosrtc/www/cordova-plugin-iosrtc.js

My Code: On device ready method, I am doing this:

if (window.device.platform === 'iOS') {
            cordova.plugins.iosrtc.registerGlobals();
}
        $('body').append('<video id="scannerCameraPreview" class="camera" muted autoplay="autoplay" playsinline="playsinline" webkit-playsinline style="width:100%;height:calc(100vh - 150px);position:absolute;left:150px;top:100px;object-fit:fill; opacity: 1"></video>');

        let constraints;
        let platform = window.device.platform;
        if (platform == "browser") {
            constraints = {
                video: true,
                audio: false
            }
        } else {
            constraints = {
                video: { facingMode: { exact: "environment" } },
                audio: false
            }
        }

        constraints.video.width = { exact: 1280 };
        constraints.video.height = { exact: 720 };

        navigator.mediaDevices.getUserMedia(constraints).then(function(stream) {

            let camera = $("#scannerCameraPreview");

            cordova.plugins.iosrtc.observeVideo(camera);

            // Attach local stream to video element
            camera.srcObject = stream;

        }).catch(function(err) {
            console.error('getUserMediaError', err, err.stack);
            handle(error, errorCallback);
        });

Here my app is going in the catch block throwing that error (event must have a valid type property) Please help me out what am I doing wrong. Thanks

hthetiot commented 1 year ago

Here my app is going in the catch block throwing that error (event must have a valid type property)

Can you provide the full error stack using Safari remote debug ? This may be a know issues. Can you also tell me what webrtc framework you use if any, this may help also.

hthetiot commented 1 year ago

Not sure you need this anymore

cordova.plugins.iosrtc.observeVideo(camera)

hthetiot commented 11 months ago

@aks7665 feele free to open separate issue if your problems persists.