react-native Platform:
- iOS
- Android
Issue:
I am trying to capture screen. when video is pause. But whenever I trying to capture image from video. its throwing waring and unable to capture that;
Possible Unhandled Promise Rejection (id: 25): Error: The content size must not be zero or negative. Got: (0, 410)
Library version:
"react-native-video": "^5.1.0-alpha8",
"react-native-view-shot": "^3.1.2",
Code:
const viewShotRef = useRef(null);
const [uri, setUri] = useState('');
<ViewShot
style={[styles.imageViewerStyleVideo, {height: 410}]}
ref={viewShotRef}
captureMode="continuous"
options={{format: 'jpg', quality: 0.9}}>
<Video
ref={(p) => {
videoRef = p;
}}
paused={isPaused}
source={getImageSource(caseViewerVideo)}
resizeMode={'contain'}
selectedVideoTrack={'auto'}
style={styles.fullScreenMode}
controls={true}
playInBackground={false}
playWhenInactive={false}
/>
</ViewShot>
<Pressable
style={{
width: 40,
height: 40,
borderWidth: 1,
borderRadius: 20,
position: 'absolute',
top: 260,
right: 80,
borderColor: Colors.pencil,
backgroundColor: Colors.shadow,
}}
onPress={() => onCapture()}
/>
const onCapture = async () => {
const uri = await viewShotRef.current.capture();
setUri(uri);
console.log(uri);
};