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
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
9 changed files with 47 additions and 23 deletions

View File

@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.3)
activesupport (5.2.4.5)
activesupport (5.2.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
@ -15,7 +15,7 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.1.1)
aws-partitions (1.432.0)
aws-partitions (1.436.0)
aws-sdk-core (3.113.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
@ -24,7 +24,7 @@ GEM
aws-sdk-kms (1.43.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.91.0)
aws-sdk-s3 (1.93.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
@ -97,7 +97,7 @@ GEM
faraday_middleware (1.0.0)
faraday (~> 1.0)
fastimage (2.2.3)
fastlane (2.178.0)
fastlane (2.179.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
artifactory (~> 3.0)
@ -196,7 +196,7 @@ GEM
jwt (2.2.2)
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.0.2)
mini_mime (1.0.3)
minitest (5.14.4)
molinillo (0.6.6)
multi_json (1.15.0)
@ -260,7 +260,7 @@ GEM
xcpretty (~> 0.2, >= 0.0.7)
PLATFORMS
ruby
universal-darwin-20
DEPENDENCIES
cocoapods

View File

@ -1,4 +1,4 @@
fastlane_version "2.178.0"
fastlane_version "2.179.0"
skip_docs
ensure_env_vars(

View File

@ -138,6 +138,23 @@ const ComponentInstance: React.FC<Props> = ({
) : null}
<View style={styles.base}>
<View style={styles.inputRow}>
<TextInput
style={[
styles.prefix,
{
borderBottomColor: instanceQuery.isError
? theme.red
: theme.border
}
]}
editable={false}
children={
<Text
style={{ color: theme.primaryDefault }}
children='https://'
/>
}
/>
<TextInput
style={[
styles.textInput,
@ -246,6 +263,11 @@ const styles = StyleSheet.create({
flexDirection: 'row',
marginHorizontal: StyleConstants.Spacing.Global.PagePadding
},
prefix: {
borderBottomWidth: 1,
...StyleConstants.FontStyle.M,
paddingRight: StyleConstants.Spacing.XS
},
textInput: {
flex: 1,
borderBottomWidth: 1,

View File

@ -139,7 +139,7 @@ const Timeline: React.FC<Props> = ({
ref={customFLRef || flRef}
scrollEventThrottle={16}
onScroll={onScroll}
windowSize={10}
windowSize={7}
data={flattenData}
initialNumToRender={6}
maxToRenderPerBatch={3}

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 },

View File

@ -34,7 +34,9 @@ const prefetchEmojis = (
requestedIndex++
})
})
FastImage.preload(prefetches)
try {
FastImage.preload(prefetches)
} catch {}
}
const ComposeRoot = React.memo(

View File

@ -78,7 +78,7 @@ const ComposeEmojis: React.FC = () => {
keyExtractor={item => item.shortcode}
renderSectionHeader={listHeader}
renderItem={listItem}
windowSize={3}
windowSize={2}
/>
</View>
)

View File

@ -38,10 +38,8 @@ const TabSharedUsers = React.memo(
return (
<FlatList
windowSize={11}
windowSize={7}
data={flattenData}
initialNumToRender={5}
maxToRenderPerBatch={5}
style={styles.flatList}
renderItem={renderItem}
onEndReached={onEndReached}

View File

@ -1,11 +1,14 @@
import { Audio } from 'expo-av'
import log from "./log"
import log from './log'
const audio = () => {
log('log', 'audio', 'setting audio playback default options')
Audio.setAudioModeAsync({
playsInSilentModeIOS: true,
interruptionModeIOS: 1
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
shouldDuckAndroid: true,
playThroughEarpieceAndroid: true
})
}