Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Android youtube播放器无法正常工作_Javascript_Android_React Native - Fatal编程技术网

Javascript Android youtube播放器无法正常工作

Javascript Android youtube播放器无法正常工作,javascript,android,react-native,Javascript,Android,React Native,大家好,我正在尝试使用react native youtube获得一个youtube播放器,但我在安卓系统中获得了一个无休止加载的黑屏。它在iOS中运行良好。有人知道为什么吗 代码如下: <View> <YouTube apiKey="APIKEY" videoId={this.state.videoUrls} // The YouTube video ID play = {this.

大家好,我正在尝试使用
react native youtube
获得一个youtube播放器,但我在安卓系统中获得了一个无休止加载的黑屏。它在iOS中运行良好。有人知道为什么吗

代码如下:

 <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>

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})}
样式={{alignSelf:'stretch',高度:250}
/>
编辑:视频ID的代码

     <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>

{
this.state.dataVideos.map((项目,i)=>
this.setState({videoUrls:item.contentDetails.videoId})}>
{item.snippet.title}
)}

您是否能够在示例应用程序中构建、运行和播放相同的媒体?是的,如果我在示例中传递视频的id,我可以。它加载了视频,我将用代码编辑,在那里我可以看到视频的id。。。也许您需要检查示例代码与您的代码之间的差异。它取自示例代码。。。它可以在iOS上运行,但不能在android上运行。在我能在示例应用程序中构建和运行并播放相同媒体之前,没有人会有这个错误?是的,如果我通过了这个例子中视频的id,我可以。它加载了视频,我将用代码编辑,在那里我可以看到视频的id。。。也许您需要检查示例代码与您的代码之间的差异。它取自示例代码。。。它可以在iOS上运行,但不能在android上运行。在我之前没有人会犯这个错误