Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loadingRender={() => }
/>
);
}
if (attachment && attachment.video_url) {
const [loading, setLoading] = useState(true);
const uri = formatAttachmentUrl(attachment.video_url, user.id, user.token, baseUrl);
return (
<>
<video style="{styles.video}"> setLoading(false)}
onLoadStart={() => setLoading(true)}
onError={console.log}
/>
{ loading ? : null }
);
}
return null;
});
</video>
};
}
| Asset;
},
State
> {
readonly state: State = {
isLoaded: false,
isLooping: false,
isPlaying: false,
positionMillis: 0,
durationMillis: 0,
rate: 1,
shouldCorrectPitch: false,
useNativeControls: false,
resizeMode: Video.RESIZE_MODE_CONTAIN,
};
_video?: Video;
_handleError = (errorMessage: string) => this.setState({ errorMessage });
_handleVideoMount = (ref: Video) => (this._video = ref);
_updateStateToStatus = (status: any) => this.setState(status);
_playAsync = async () => this._video!.playAsync();
_pauseAsync = async () => this._video!.pauseAsync();
_setPositionAsync = async (position: number) => this._video!.setPositionAsync(position);
iconName: 'options',
title: 'Native controls',
onPress: this._toggleNativeControls,
active: this.state.useNativeControls,
},
{
iconName: 'move',
title: 'Resize mode – stretch',
onPress: this._resizeModeSetter(Video.RESIZE_MODE_STRETCH),
active: this.state.resizeMode === Video.RESIZE_MODE_STRETCH,
},
{
iconName: 'log-in',
title: 'Resize mode – contain',
onPress: this._resizeModeSetter(Video.RESIZE_MODE_CONTAIN),
active: this.state.resizeMode === Video.RESIZE_MODE_CONTAIN,
},
{
iconName: 'qr-scanner',
title: 'Resize mode – cover',
onPress: this._resizeModeSetter(Video.RESIZE_MODE_COVER),
active: this.state.resizeMode === Video.RESIZE_MODE_COVER,
},
{
iconName: 'resize',
title: 'Open fullscreen',
onPress: this._openFullscreen,
active: false,
},
]}
header={this._renderVideo()}
/>
{
iconName: 'options',
title: 'Native controls',
onPress: this._toggleNativeControls,
active: this.state.useNativeControls,
},
{
iconName: 'move',
title: 'Resize mode – stretch',
onPress: this._resizeModeSetter(Video.RESIZE_MODE_STRETCH),
active: this.state.resizeMode === Video.RESIZE_MODE_STRETCH,
},
{
iconName: 'log-in',
title: 'Resize mode – contain',
onPress: this._resizeModeSetter(Video.RESIZE_MODE_CONTAIN),
active: this.state.resizeMode === Video.RESIZE_MODE_CONTAIN,
},
{
iconName: 'qr-scanner',
title: 'Resize mode – cover',
onPress: this._resizeModeSetter(Video.RESIZE_MODE_COVER),
active: this.state.resizeMode === Video.RESIZE_MODE_COVER,
},
{
iconName: 'resize',
title: 'Open fullscreen',
onPress: this._openFullscreen,
active: false,
},
]}
header={this._renderVideo()}
{this.state.playbackInstanceName}
render() {
const platform = propOr('unknown', Constants, 'platform');
return (
);
}
}