I am trying to autoplay the youtube embedded video in my react native app.
here is my code,
render() {
const { data } = this.props;
const { loading } = this.state;
return (
<View>
<CloseButton onTrigger={this.closeModal.bind(this)} />
<PlayIcon onTrigger={this.playVideo} />
<Image source={{uri:data.src}} resize='contain' style={{height:250}} />
<Image
source={require('../../assets/img/grediant.png')}
resizeMode='cover' style={styles.gradientImage} />
<ContentWidget style={styles.infoContentTwo}>
<MyAppText style={{color:'white'}}>{data.title}</MyAppText>
</ContentWidget>
{this.state.openVideo && <View style={styles.webViewStyle}>
<WebView style={{height:250}} source={{uri:`${data.video}?autoplay=1`}} fullScreen={true} />
</View>}
{loading && <Spinner />}
</View>
);
}
but it's not working, I have a playIcon custom button, if I click that button then youtube video should play. I don't know where I am wrong in the code.