Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.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
Html 在我更新音频元素中的'src'之后,事件侦听器会发生什么情况?(反应)_Html_Reactjs_Audio_Redux_React Redux - Fatal编程技术网

Html 在我更新音频元素中的'src'之后,事件侦听器会发生什么情况?(反应)

Html 在我更新音频元素中的'src'之后,事件侦听器会发生什么情况?(反应),html,reactjs,audio,redux,react-redux,Html,Reactjs,Audio,Redux,React Redux,以这种方式处理歌曲更改是否有效? 在我更新src并重新播放Audio元素之后,事件侦听器会发生什么情况 <audio ref={ref => (this._player = ref)} onEnded={() => this.next()} src={this.props.active_song.audio_file} onCanPlayThrough={this.onCanPlay.bind(this)} onTimeUpdate={this.listen

以这种方式处理歌曲更改是否有效?
在我更新
src
并重新播放
Audio
元素之后,事件侦听器会发生什么情况

<audio
  ref={ref => (this._player = ref)}
  onEnded={() => this.next()}
  src={this.props.active_song.audio_file}
  onCanPlayThrough={this.onCanPlay.bind(this)}
  onTimeUpdate={this.listenProgress.bind(this)}
  onPause={this.onPause.bind(this)}
  onPlay={this.onPlay.bind(this)}
  autoPlay={this.state.play}
  preload="none"
>
</audio>
(this.\u player=ref)}
onEnded={()=>this.next()}
src={this.props.active_song.audio_file}
onCanPlayThrough={this.onCanPlay.bind(this)}
onTimeUpdate={this.listenProgress.bind(this)}
onPause={this.onPause.bind(this)}
onPlay={this.onPlay.bind(this)}
自动播放={this.state.play}
预加载=“无”
>

事件侦听器不会发生任何事情

动态更改
src
时,只更改url源,而不更改加载的音频流

要播放新音频,您必须加载并播放它

this._player.pause();
this._player.load();
this._player.play();