diff --git a/app/containers/message/Video.js b/app/containers/message/Video.js index 05daa67b4..3af3812a6 100644 --- a/app/containers/message/Video.js +++ b/app/containers/message/Video.js @@ -1,10 +1,11 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { View, StyleSheet, TouchableOpacity, Image } from 'react-native'; +import { View, StyleSheet, TouchableOpacity, Image, Linking } from 'react-native'; import { connect } from 'react-redux'; import Modal from 'react-native-modal'; import VideoPlayer from 'react-native-video-controls'; +const SUPPORTED_TYPES = ['video/webm']; const styles = StyleSheet.create({ container: { flex: 1, @@ -43,19 +44,31 @@ export default class Video extends React.PureComponent { }; } + isTypeSupported() { + return SUPPORTED_TYPES.indexOf(this.props.file.video_type) === -1; + } + toggleModal() { this.setState({ isVisible: !this.state.isVisible }); } + open() { + if (!this.isTypeSupported()) { + Linking.openURL(this.state.uri); + } else { + this.toggleModal(); + } + } + render() { const { isVisible, uri } = this.state; return ( this.toggleModal()} + onPress={() => this.open()} >