Skip to content

Integrate Android webrtc with Google Facebook detection Api #3

@shoaib086

Description

@shoaib086

I am trying to integrate android webrtc with Face detection to use one camera but find no common ground between both of them as webrtc is using "org.webrtc.VideoSource" and facedetection is using "com.google.android.gms.vision.CameraSource". how do I eliminate one of the camera? Code for webrtc camera initialization is

VideoCapturerAndroid vc = VideoCapturerAndroid.create(VideoCapturerAndroid.getNameOfBackFacingDevice(), null);

 // VideoCapturerAndroid vc = VideoCapturerAndroid.create(VideoCapturerAndroid.getNameOfFrontFacingDevice(), null);


 localVideoSource = peerConnectionFactory.createVideoSource(vc, new MediaConstraints());
 VideoTrack localVideoTrack = peerConnectionFactory.createVideoTrack(VIDEO_TRACK_ID, localVideoSource);
 localVideoTrack.setEnabled(true);

 AudioSource audioSource = peerConnectionFactory.createAudioSource(new MediaConstraints());
 AudioTrack localAudioTrack = peerConnectionFactory.createAudioTrack(AUDIO_TRACK_ID, audioSource);
 localAudioTrack.setEnabled(true);

 localMediaStream = peerConnectionFactory.createLocalMediaStream(LOCAL_STREAM_ID);
 localMediaStream.addTrack(localVideoTrack);
 localMediaStream.addTrack(localAudioTrack);

and code for camera of Google Face detection is:

 mCameraSource = new CameraSource.Builder(context, detector)
            .setRequestedPreviewSize(640, 480)
            .setFacing(CameraSource.CAMERA_FACING_BACK)
            .setRequestedFps(15.0f)
            .build();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions