DoubangoTelecom / imsdroid

High Quality Video SIP/IMS client for Google Android
https://doubango.org
Other
294 stars 168 forks source link

Unable to see preview of producer camera when in the in-progress state (ACTION INVITE) #633

Open basheerkohli opened 4 years ago

basheerkohli commented 4 years ago

When initiating a video call I just tried to show the preview of the producer camera view returned invoking the method

public final View startVideoProducerPreview(){ if(mVideoProducer != null){ return mVideoProducer.startPreview(mContext); } return null; }

But unfortunately, I am getting null every time in the in-progress state. The video producer is only getting initiated when the call state is INCALL.

Can we show the preview of the caller on-screen before the call gets connected?

Expected output :

When the video call is in-progress state the preview of the caller should be displayed on his screen.

IMSDroid demo application output: Rendering the loading try-view in the IMSDroid demo application.

SamarthaKV29 commented 4 years ago

You have to check where it is getting initialized. here's what it looks like you missed: image

Luckily for you I recently had looked through this exact piece for something, So I remember seeing that inside certain

handleSipEvent() & handleMediaEvent functions, in avSession mostly, it won't initialize the producers until it receives IN_CALL message. Maybe that is your problem. But thanks for the idea. What you are trying to do is cool and Whatsapp like.. You just need to load the camera preview use something like NgnCamaraProducer.getInstance() and then show the preview. Why are you complicating it!?

Once you get IN_CALL, the producers are loaded automatially right, so just go with it. Don't need to change that part, just create a new View Layout and load that view when you are in states of IN_PROGRESS or something. Just like the incoming CALL DIALOG. Let me know if you have issues, and let me know if you need help. I have worked with Doubango for over 2-3 years now, so I know this inside out, to some extent.

SamarthaKV29 commented 4 years ago

Also, in your AVScreen activity, you'll manage the VIEW depending on avSession STATE. its really simple, just replace the loadTryingView with a VIEW THAT you want, use a SurfaceView or TextureView, and load the CameraPreview, and use that inside StartPreview .. You use a if (IN_PROGRESS) showCamPreview(); else loadInCallView() Something as simple as that should do it.

basheerkohli commented 4 years ago

NgnAVSession.Java public final View startVideoProducerPreview(){ if(mVideoProducer != null){ return mVideoProducer.startPreview(mContext); } return null; }

mVideoProducer is getting initialized when the INVITE state is INCALL. So the only thing I can do is before reaching the INCALL state need to create SurfaceView and attach a camera instance to it and then invoke the preview function. Once the call INVITE state reaches INCALL I need to release my camera lock and remove the surface view.

Thanks for your suggestions. Cheers.