Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28460

Android youtube player not working react-native

$
0
0

Hi I'm trying to get an youtube player using react-native-youtube but I'm getting a black screen with an endless loading in android. It works well in iOS. Does someone have an idea why ?

Here is the code :

 <View>
          <YouTube
            apiKey="APIKEY"
            videoId={this.state.videoUrls} // The YouTube video ID
            play = {this.state.isPlaying} // control playback of video with true/false
            fullscreen = {this.state.fullscreen} // control whether the video should play in fullscreen or inline
            loop = {this.state.isLooping}// control whether the video should loop when ended
            onReady={e => this.setState({ isReady: true })}
            onChangeState={e => this.setState({ status: e.state })}
            onChangeQuality={e => this.setState({ quality: e.quality })}
            onError={e => this.setState({ error: e.error })}
            style={{ alignSelf: 'stretch', height: 250 }}
            />
</View>

EDIT : the code of the videoId

     <View style = {styles.containerPlaylist}>
          <View>
              {
                this.state.dataVideos.map((item,i) => 
                <TouchableHighlight
                key = {item.contentDetails.videoId}
                onPress = {()=> this.setState({videoUrls: item.contentDetails.videoId})}>
                <View style = {styles.vids}>
                  <Image
                    source = {{uri: item.snippet.thumbnails.medium.url}}
                    style = {{flex: 2, height: '100%', backgroundColor:'#fff', resizeMode:'contain'}}
                    />
                      <Text style = {styles.vidText}>{item.snippet.title}</Text>
                  </View>
                </TouchableHighlight>
                )}
          </View>
      </View>

Viewing all articles
Browse latest Browse all 28460

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>