简体   繁体   中英

How to show Front Camera Preview on Framelayout using Camera2 in Android?

I am working in one application, In which I am using tokbox for the video calling, But before displaying the Active call screen, I need to show the front camera preview to the user. Using tokbox publisher we can't do that otherwise, the video will reach the end user before call accept.

So How can we show Front Camera Video preview(Just the preview, I don't need any capturing or anything) in the framelayout using Camera2 API of Android?

您可以使用实例化发布者并使用其视图,而不是最初不发布到会话。

You can get a preview from the Publisher by calling Publisher.startPreview() . This will start the camera and put it on the Publisher.getView() that you can put in your UI.

Don't forget to do Publisher.destory() if you do this. I didn't do that at first and noticed issues of the camera not being released correctly after TokBox sessions on older (non-Camera2) devices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM