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

Partial fix #90

Now playing gifv won't interrupt existing audio playing. But when switching app state, it still will.
This commit is contained in:
Zhiyuan Zheng
2021-03-29 23:53:49 +02:00
parent c4ec88609e
commit 4be0fb5a5f
9 changed files with 47 additions and 23 deletions

View File

@ -1,7 +1,7 @@
import Button from '@components/Button'
import { StyleConstants } from '@utils/styles/constants'
import { Video } from 'expo-av'
import React, { useCallback, useEffect, useRef, useState } from 'react'
import React, { useCallback, useRef, useState } from 'react'
import { Pressable, StyleSheet, View } from 'react-native'
import { Blurhash } from 'react-native-blurhash'
import attachmentAspectRatio from './aspectRatio'
@ -54,12 +54,6 @@ const AttachmentVideo: React.FC<Props> = ({
})
}, [videoLoaded, videoPosition])
useEffect(() => {
if (gifv) {
videoPlayer.current?.setIsLoopingAsync(true)
}
}, [])
return (
<View
style={[
@ -76,7 +70,12 @@ const AttachmentVideo: React.FC<Props> = ({
}}
usePoster
{...(gifv
? { shouldPlay: true, source: { uri: video.url } }
? {
shouldPlay: true,
isMuted: true,
isLooping: true,
source: { uri: video.url }
}
: {
resizeMode: 'cover',
posterSource: { uri: video.preview_url },