0

I am using react-native-video in a flatList, items are combination of images and videos like Instagram, so it's possible an item itself contains multiple video. I want to stop loading video if another video is playing. Is this possible? now I handle this in this way: If video is not playing I use Image component that shows video thumbnail otherwise Video component is rendered, my problem with this method is that if I scroll in the list each time video start loading from beginning even if it's loaded before. Also I tried using react-native-video-cache to resolve this issue, but in that way some video couldn't play. I think its because of caching. Am I wrong? thanks for any help

BeginnerProgrammer
  • 664
  • 3
  • 13
  • 27
  • if any video is playing try to set source uri to null for other videos (but all data loaded before will be lost of the preview played video) or you can set programmatically the video preload attribute to none (preload="none") for the video element – Christa Jul 23 '23 at 17:04
  • @Lapwood I can't find preload property for Video component. – BeginnerProgrammer Jul 23 '23 at 17:38
  • the videoElement is accessible at the RCTVideo component you can do something like const RCTVideoInstance = this.getViewManagerConfig('RCTVideo'); RCTVideoInstance.videoElement.setAttribute('preload', none); – Christa Jul 23 '23 at 20:43

0 Answers0