Skip to content

Commit

Permalink
Testing cache
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonhenry committed Feb 29, 2024
1 parent 290e12e commit 5d27119
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ allprojects {
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
maven {
url "$rootDir/../node_modules/react-native-video-cache/android/libs"
}

}
}

Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
"react-native-svg": "14.1.0",
"react-native-tab-view": "^3.5.2",
"react-native-url-polyfill": "^2.0.0",
"react-native-video-cache": "^2.7.4",
"react-native-view-shot": "3.8.0",
"react-native-vision-camera": "2.16.8",
"react-native-web": "^0.19.9",
Expand Down
7 changes: 5 additions & 2 deletions src/components/VideoPlayer/BaseVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import * as Browser from '@libs/Browser';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import CONST from '@src/CONST';
import convertToProxyURL from 'react-native-video-cache';

import {videoPlayerDefaultProps, videoPlayerPropTypes} from './propTypes';
import shouldReplayVideo from './shouldReplayVideo';
import VideoPlayerControls from './VideoPlayerControls';
Expand Down Expand Up @@ -51,7 +53,8 @@ function BaseVideoPlayer({
const [isPlaying, setIsPlaying] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const [isBuffering, setIsBuffering] = useState(true);
const [sourceURL] = useState(url.includes('blob:') || url.includes('file:///') ? url : addEncryptedAuthTokenToURL(url));
const cachedUrl = url.includes('blob:') || url.includes('file:///') ? url : addEncryptedAuthTokenToURL(url);
const [sourceURL] = useState(convertToProxyURL(cachedUrl));
const [isPopoverVisible, setIsPopoverVisible] = useState(false);
const [popoverAnchorPosition, setPopoverAnchorPosition] = useState({horizontal: 0, vertical: 0});
const videoPlayerRef = useRef(null);
Expand Down Expand Up @@ -169,7 +172,7 @@ function BaseVideoPlayer({
originalParent.appendChild(sharedElement);
};
}, [bindFunctions, currentVideoPlayerRef, currentlyPlayingURL, isSmallScreenWidth, originalParent, sharedElement, shouldUseSharedVideoElement, url]);

return (
<>
<View style={style}>
Expand Down

0 comments on commit 5d27119

Please sign in to comment.