Add android take snapshot feature #365
Open
+281
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#358
Take snapshot of remote participant video for Android.
For iOS, use
react-native-view-shot
.A few changes I made that might not make it to the master branch.
I created this PR as a reference for anyone in the future who might need this feature.
PatchedVideoView
now extendsVideoTextureView
, previouslyVideoView
.this.getSurfaceViewRenderer().applyZOrder(true);
asVideoTextureView
don't have that method.captureBitmapFromYuvFrame
doesn't freeze video likegetBitmap
does (noticeably longer). So I am keeping the implementation since it's working.takeSnapshot
interceptsrenderFrame
and convert the frame tobitmap
, then to temp image file.It takes snapshot of 1 participant view. (For multiple views in 1 image, you might want to think about other way to do it.)
Usage:
Sample uri
/data/user/0/com.xxx/cache/snapshot_video3186517848496583071.png