mukherjeesudebi / audio-addon

Apache License 2.0
0 stars 0 forks source link

audio-element.ts not bundled #1

Open theotherp opened 2 weeks ago

theotherp commented 2 weeks ago

Hi.

Thanks for this addon but I can't get it working:

2024-09-10T21:33:30.632+02:00 ERROR 37388 --- [nio-8099-exec-4] c.v.flow.component.internal.UIInternals : The component class de.sist.ha.web.views.say.SpeakFromWeb includes './audio-element.ts' but this file was not included when creating the production bundle. The component will not work properly. Check that you have a reference to the component and that you are not using it only through reflection. If needed add a @Uses(SpeakFromWeb.class) where it is used.

Sorry if this is a stupid mistake on my part but I'm new to vaadin.

This is my code:

@PageTitle("speak")
@Route(value = "speak", layout = MainLayout.class)
@Uses(Audio.class)
@Uses(SpeakFromWeb.class)
@JsModule("./audio-element.ts")
@Log4j2
public class SpeakFromWeb extends VerticalLayout {

    public SpeakFromWeb() {
        Audio audio = new Audio();
        add(audio);
        audio.addStartListener(event -> log.info("Started recording"));
        audio.addStopListener(event -> {
            log.info("Stopped recording");
            System.out.println(audio.getRecordedAudio());
        });
    }
}

(I added any annotations I thought may help).

mukherjeesudebi commented 1 day ago

You do not need the @JsModule and @Uses The below should be fine. Can you please check and let me know.

@PageTitle("speak")
@Route(value = "speak")
public class SpeakFromWeb extends VerticalLayout {

    public SpeakFromWeb() {
        Audio audio = new Audio();
        add(audio);
        audio.addStartListener(event -> System.out.println(("Started recording")));
        audio.addStopListener(event -> {
            System.out.println("Stopped recording");
            System.out.println(audio.getRecordedAudio());
        });
    }
}
theotherp commented 1 day ago

Thanks for the response.

I don't knoy why it worked before but not with development mode I get: Caused by: java.lang.IllegalStateException: Running project in development mode with no access to folder 'C:\Users\Sudebi\Vaadin\Workspace\AddonsComponents\AudioAddon\audio'..

mukherjeesudebi commented 22 hours ago

It works fine locally for me. Are you using vaadin 24.4? Also, can you try doing a clean install and even after that it does not work, then can you kindly share a sample project. It would be very helpful to identify any underlying issue.