Get information about the error?
Skit opened this issue · 2 comments
How do I get information about the error?
<ReactHowler
src={this.state.stream.src}
onLoadError={this.handleOnLoadError}
onLoad={this.handleOnLoad}
onPlay={this.handleOnPlay}
preload={false}
playing={this.state.isPlay}
html5={true}
format={[this.state.stream.type]}
ref={(ref) => (this.player = ref)}
/>
/* */
constructor(props) { super(props);
//.....
this.handleOnLoadError = this.handleOnLoadError.bind(this);
}
/* */
handleOnLoadError(){
console.log('handleOnLoadError');
}
console.log screen
Thanks!
Howler will execute this callback with a string parameter explaining the error.
Try this in your code:
handleOnLoadError(message){
console.log(message);
}
You can see the possibilities in the Howler code itself if you search for loaderror
.
Some examples:
Line 587 self._emit('loaderror', null, 'No codec support for selected audio sources.');
Line 2105 self._emit('loaderror', null, 'Failed loading audio file with status: ' + xhr.status + '.');
Line 2150 self._emit('loaderror', null, 'Decoding audio data failed.');
Thanks!
handleOnLoadError(message){
if(message !== null){ /* */
}
I get the call twice (when have an error and not), probably that`s ok.