1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Use the same subdomain for connect media

Preventing count as cache miss
This commit is contained in:
xmflsct
2023-01-31 14:26:43 +01:00
parent 602e010cfc
commit 624c1f172c
10 changed files with 36 additions and 22 deletions

View File

@ -1,6 +1,7 @@
import Button from '@components/Button'
import GracefullyImage from '@components/GracefullyImage'
import { Slider } from '@sharcoux/slider'
import { connectMedia } from '@utils/api/helpers/connect'
import { StyleConstants } from '@utils/styles/constants'
import { useTheme } from '@utils/styles/ThemeManager'
import { Audio } from 'expo-av'
@ -26,7 +27,7 @@ const AttachmentAudio: React.FC<Props> = ({ total, index, sensitiveShown, audio
const playAudio = useCallback(async () => {
if (!audioPlayer) {
const { sound } = await Audio.Sound.createAsync(
{ uri: audio.url },
connectMedia({ uri: audio.url }) as { uri: string },
{},
// @ts-ignore
props => setAudioPosition(props.positionMillis)

View File

@ -1,5 +1,6 @@
import Button from '@components/Button'
import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
import { connectMedia } from '@utils/api/helpers/connect'
import { useAccountStorage, useGlobalStorage } from '@utils/storage/actions'
import { StyleConstants } from '@utils/styles/constants'
import { ResizeMode, Video, VideoFullscreenUpdate } from 'expo-av'
@ -41,7 +42,7 @@ const AttachmentVideo: React.FC<Props> = ({
const playOnPress = async () => {
setVideoLoading(true)
if (!videoLoaded) {
await videoPlayer.current?.loadAsync({ uri: video.url })
await videoPlayer.current?.loadAsync(connectMedia({ uri: video.url }) as { uri: string })
}
setVideoLoading(false)
@ -71,10 +72,10 @@ const AttachmentVideo: React.FC<Props> = ({
shouldPlay: reduceMotionEnabled || !shouldAutoplayGifv ? false : true,
isMuted: true,
isLooping: true,
source: { uri: video.url }
source: connectMedia({ uri: video.url }) as { uri: string }
}
: {
posterSource: { uri: video.preview_url },
posterSource: connectMedia({ uri: video.preview_url }),
posterStyle: { resizeMode: ResizeMode.COVER }
})}
useNativeControls={false}