Skip to content

Multiple Wavesurfer instances and bottom player in React / Next.js (Soundcloud like implementation) #3190

Answered by katspaugh
jeanchaneto asked this question in Q&A
Discussion options

You must be logged in to vote

You can sync the bottom player with the currently playing track by making them share the same media element.

E.g.

const topPlayers = topTracks.map((url) => WaveSurfer.create({ container, url }))
const currentPlayer = topPlayers[0]
const bottomPlayer = WaveSurfer.create({ container, media: currentPlayer.getMediaElement() })

The bottom player will then play, pause and seek whenever the current player is played/paused/seeking.

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
5 replies
@jeanchaneto
Comment options

@Stianlars1
Comment options

@jeanchaneto
Comment options

@Stianlars1
Comment options

@katspaugh
Comment options

Answer selected by jeanchaneto
Comment options

You must be logged in to vote
7 replies
@katspaugh
Comment options

@katspaugh
Comment options

@Miltonbhowmick
Comment options

@katspaugh
Comment options

@Miltonbhowmick
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants