Upgrading to 2.0.6 I ran into a problem when loading new audio files into the player, the timeline would fail to render.
Inside the timeline code, the call for this.wavesurfer.backend.getDuration() returned NaN. Perhaps it's a race condition where the timeline request comes before the audio file is fully downloaded?
I have the song duration available from the models, so my solution was to add a duration parameter when I initialized the timeline plugin:
I then had to hack the timeline code to add handling for this parameter, updating the this.wavesurfer.backend.getDuration() request:
var duration = (this.wavesurfer.backend.getDuration()) ? this.wavesurfer.backend.getDuration() : this.wavesurfer.timeline.params.duration;
I think it makes sense to be able to pass a duration parameter to timeline on initialization. It would be a nice enhancement.
It is a workaround for the deeper issue of why the this.wavesurfer.backend.getDuration() request sometimes returns NaN. Is anybody else experiencing this issue?
Upgrading to 2.0.6 I ran into a problem when loading new audio files into the player, the timeline would fail to render.
Inside the timeline code, the call for this.wavesurfer.backend.getDuration() returned NaN. Perhaps it's a race condition where the timeline request comes before the audio file is fully downloaded?
I have the song duration available from the models, so my solution was to add a duration parameter when I initialized the timeline plugin:
I then had to hack the timeline code to add handling for this parameter, updating the this.wavesurfer.backend.getDuration() request:
var duration = (this.wavesurfer.backend.getDuration()) ? this.wavesurfer.backend.getDuration() : this.wavesurfer.timeline.params.duration;
I think it makes sense to be able to pass a duration parameter to timeline on initialization. It would be a nice enhancement.
It is a workaround for the deeper issue of why the this.wavesurfer.backend.getDuration() request sometimes returns NaN. Is anybody else experiencing this issue?