katspaugh / wavesurfer.js

Audio waveform player
https://wavesurfer.xyz
BSD 3-Clause "New" or "Revised" License
8.45k stars 1.6k forks source link

Play .m3u playlists #571

Closed chinshr closed 7 years ago

chinshr commented 8 years ago

I love wavesurfer.js! It would be great to have a way to play .m3u playlists in wavesurfer.js, because m3u playlists reference smaller mp3 snippets within. The idea is to (a) employ it to use it as streaming audio format, and, (b) consecutively play smaller mp3 "snippets" that can be loaded and rendered properly, given they are small enough (solve some of these #558, #512 or #458). In my case, I am pre-generating the waveform (json) ahead, so I could also provide smaller waveform snippets along with the mp3 equivalent and reference them from within the m3u (if that's possible). Essentially, something like this:

var wavesurfer = WaveSurfer.create({
    container: '#wave',
});
wavesurfer.load('http://example.com/audio.m3u');

Would love to hear your thoughts on this and if you think this is the right approach to some of the problems we are seeing with larger files? If this makes sense, I am more than willing to sponsor a development effort. Please outline in enough detail on how someone could implement it?

katspaugh commented 8 years ago

The outline of the work to be done:

chinshr commented 8 years ago

Thanks for the outline. Looking into peaks.js, I am wondering where the two libraries significantly differ from each other. I want to explore peaks.js, mainly for the architectural difference that larger audio files can be rendered properly.

entonbiba commented 7 years ago

@katspaugh @chinshr I'll create a parser for m3u files. Essentially it would create an array of mp3 lists which can be switched via a "next" and "prev" methods. Not sure if combining all the files from a .m3u file would be feasible due to size and browser resources for now. I'm aiming for version 1.3.5 to have a parser method ready if all goes well.

1018

thijstriemstra commented 7 years ago

There's a playlist plugin now that handles this.