[FIX] Open unsupported videos on browser (#422)
This commit is contained in:
parent
de1a63c815
commit
e1952ca146
|
@ -40,6 +40,12 @@ export default class Video extends React.PureComponent {
|
||||||
|
|
||||||
state = { isVisible: false };
|
state = { isVisible: false };
|
||||||
|
|
||||||
|
get uri() {
|
||||||
|
const { video_url } = this.props.file;
|
||||||
|
const { baseUrl, user } = this.props;
|
||||||
|
return `${ baseUrl }${ video_url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
|
||||||
|
}
|
||||||
|
|
||||||
toggleModal() {
|
toggleModal() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isVisible: !this.state.isVisible
|
isVisible: !this.state.isVisible
|
||||||
|
@ -50,14 +56,12 @@ export default class Video extends React.PureComponent {
|
||||||
if (isTypeSupported(this.props.file.video_type)) {
|
if (isTypeSupported(this.props.file.video_type)) {
|
||||||
return this.toggleModal();
|
return this.toggleModal();
|
||||||
}
|
}
|
||||||
openLink(this.state.uri);
|
openLink(this.uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { isVisible } = this.state;
|
const { isVisible } = this.state;
|
||||||
const { video_url, description } = this.props.file;
|
const { description } = this.props.file;
|
||||||
const { baseUrl, user } = this.props;
|
|
||||||
const uri = `${ baseUrl }${ video_url }?rc_uid=${ user.id }&rc_token=${ user.token }`;
|
|
||||||
return (
|
return (
|
||||||
[
|
[
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
@ -79,7 +83,7 @@ export default class Video extends React.PureComponent {
|
||||||
onBackButtonPress={() => this.toggleModal()}
|
onBackButtonPress={() => this.toggleModal()}
|
||||||
>
|
>
|
||||||
<VideoPlayer
|
<VideoPlayer
|
||||||
source={{ uri }}
|
source={{ uri: this.uri }}
|
||||||
onBack={() => this.toggleModal()}
|
onBack={() => this.toggleModal()}
|
||||||
disableVolume
|
disableVolume
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue