[FIX] Remove unsupported video format from Android (#1166)

This commit is contained in:
Diego Mello 2019-08-30 09:45:56 -03:00 committed by GitHub
parent 360451ea1e
commit 356a3e7098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -11,7 +11,6 @@ import { Video } from 'expo-av';
import sharedStyles from '../views/Styles'; import sharedStyles from '../views/Styles';
import { COLOR_WHITE } from '../constants/colors'; import { COLOR_WHITE } from '../constants/colors';
import { formatAttachmentUrl } from '../lib/utils'; import { formatAttachmentUrl } from '../lib/utils';
import log from '../utils/log';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
safeArea: { safeArea: {
@ -85,7 +84,7 @@ const ModalContent = React.memo(({
); );
} }
if (attachment && attachment.video_url) { if (attachment && attachment.video_url) {
const [loading, setLoading] = useState(0); const [loading, setLoading] = useState(true);
const uri = formatAttachmentUrl(attachment.video_url, user.id, user.token, baseUrl); const uri = formatAttachmentUrl(attachment.video_url, user.id, user.token, baseUrl);
return ( return (
<> <>
@ -101,7 +100,7 @@ const ModalContent = React.memo(({
useNativeControls useNativeControls
onReadyForDisplay={() => setLoading(false)} onReadyForDisplay={() => setLoading(false)}
onLoadStart={() => setLoading(true)} onLoadStart={() => setLoading(true)}
onError={log} onError={console.log}
/> />
{ loading ? <ActivityIndicator size='large' style={styles.loading} /> : null } { loading ? <ActivityIndicator size='large' style={styles.loading} /> : null }
</> </>

View File

@ -10,7 +10,7 @@ import { isIOS } from '../../utils/deviceInfo';
import { CustomIcon } from '../../lib/Icons'; import { CustomIcon } from '../../lib/Icons';
import { formatAttachmentUrl } from '../../lib/utils'; import { formatAttachmentUrl } from '../../lib/utils';
const SUPPORTED_TYPES = ['video/quicktime', 'video/mp4', ...(isIOS ? [] : ['video/webm', 'video/3gp', 'video/mkv'])]; const SUPPORTED_TYPES = ['video/quicktime', 'video/mp4', ...(isIOS ? [] : ['video/3gp', 'video/mkv'])];
const isTypeSupported = type => SUPPORTED_TYPES.indexOf(type) !== -1; const isTypeSupported = type => SUPPORTED_TYPES.indexOf(type) !== -1;
const styles = StyleSheet.create({ const styles = StyleSheet.create({