1

I don't know how to get the video frame , so I can't save the image.

Give me some tips. Thanks a lot.

fancyT
  • 39
  • 8

2 Answers2

1

As canvas and rest of the facilities are unavailable in Android we can dodge this situation by taking screenshots and introducing animation in our app's UI. screenshot image can be stored at configured location and resused it later for exchanging it to other party

Edit: One can take reference from AppRTC to capture surfaceview()

https://codereview.webrtc.org/1257043004/

GLSurfaceView () should not work as webrtc library has the hold of camera and screen. One has to build extended class to get Videorenderer and get the snap of frame , Once done one can display the frame using customized api displayFrame() mentioned by cferran in opentok android examples.

You can also use OpenTok library but that is chargeable when compared to webRTC.

  • Thanks Gaurav! Could you share any specific ways to solve this ? Now I use the app's UI "GLSurfaceView",but it makes no sense. I have tried many ways but failed. – fancyT Jul 15 '17 at 02:56
  • 1
    Thanks for your patience once again! The OpenTok library may be a good solution. But our company want to reduce the output. I hava found another solution! Firstly through webrtc ,I can get the I420frame in the method 'RenderFrame'. Then I convert the I420frame to YuvImage. Finally,I use the YuvImage's method 'compressToJpeg' to convert it to jpeg image. – fancyT Jul 17 '17 at 09:33
  • Liked your approach, requesting to confirm the quality and size of image saved by this method once done. – Gaurav Srivastava Jul 17 '17 at 10:15
  • I find that the image has a little gray. Now I am finding the question. – fancyT Jul 18 '17 at 01:56
0

If you are interested in using a third party library here is an example on how to implement this use case: https://github.com/opentok/opentok-android-sdk-samples/tree/master/Live-Photo-Capture

If you prefer to use directly WebRTC, here you can find generic information about how to build WebRTC on Android: https://webrtc.org/native-code/android/

cferran
  • 11
  • 1