Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wavesurfer.js not showing. but playing #3985

Closed
MarcSkovMadsen opened this issue Jan 4, 2025 · 0 comments
Closed

wavesurfer.js not showing. but playing #3985

MarcSkovMadsen opened this issue Jan 4, 2025 · 0 comments
Labels

Comments

@MarcSkovMadsen
Copy link

Context

I'm trying to help a user of HoloViz Panel using wavesurfer.js in https://discourse.holoviz.org/t/wavesurfer-js-time-series-and-spectrograms-just-how-hard-can-it-be/8491.

Panel is the 3rd most used dashboarding framework in Python according to latest Jetbrains developer survey.

Bug description

I can get wavesurfer playing. But not showing.

Environment

  • Browser: Edge

Minimal code snippet

pip install panel

Create a file app.py.

import panel as pn
import param

from panel.custom import JSComponent

pn.extension()

class WaveSurfer(JSComponent):

    value = param.Integer()

    _esm = '''
    import WaveSurfer from 'https://cdn.jsdelivr.net/npm/wavesurfer.js@7/dist/wavesurfer.esm.js'

    export function render({ model, el }) {
        function callback(){
            const wavesurfer = WaveSurfer.create({
                container: el,
                waveColor: 'rgb(200, 0, 200)',
                progressColor: 'rgb(100, 0, 100)',
                url: 'https://assets.holoviz.org/panel/samples/beatboxing.mp3',
                fetchParams: {
                    mode: 'no-cors',
                },
            })

            wavesurfer.on('interaction', () => {
                wavesurfer.play()
            })
        }

        model.on('after_render', callback)
    }
    '''

WaveSurfer(height=200, width=500, styles={"border": "1px solid black"}).servable()

Serve the application with

panel serve app.py --dev

You can also run this in the browser here without installing or serving anything.

When I click the wavesurfer container element it starts playing. But the wavesurfer is never shown. Inspecting the browser console elements I can see that the canvas elements are never created. But I do see some activitity in the div elements that should contain the canvas elements.

For context Panel is also displaying elements inside shadow dom. So could that cause the issue?

Expected result

Wavesurfer would should

Obtained result

Wavesurfer not showing

Video

wavesurferjs.mp4
Repository owner locked and limited conversation to collaborators Jan 6, 2025
@katspaugh katspaugh converted this issue into discussion #3986 Jan 6, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant