I 'm using this library to implement an audio playback in vaadin 8: https://vaadin.com/directory/component/audiovideo
This is the code of my view. Only a layout and a GwatAudio instance:
public void init() {
layout = new VerticalLayout();
String filename = "Ensoniq-3.wav";
String pathName = "C:\\PERSEO\\TADPLAYER\\";
ConnectorAudio con = new ConnectorAudio(filename, pathName);
GwtAudio atc = new GwtAudio(con);
layout.addComponent(atc);
}
And this is the resource subclass that I need to create a Gwtaudio
public class ConnectorAudio implements ConnectorResource {
/**
*
*/
private static final long serialVersionUID = 8806461248248864379L;
private String fileName;
private StreamResource resource;
public ConnectorAudio(String fileName, String pathName) {
// TODO Auto-generated constructor stub
this.fileName = fileName;
StreamSource stream = new StreamSource() {
@Override
public InputStream getStream() {
try {
return new FileInputStream(pathName + fileName);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return null;
}
};
this.resource = new StreamResource(stream, this.fileName );
}
@Override
public String getMIMEType() {
// TODO Auto-generated method stub
return this.resource.getMIMEType();
}
@Override
public DownloadStream getStream() {
// TODO Auto-generated method stub
return resource.getStream();
}
@Override
public String getFilename() {
// TODO Auto-generated method stub
return this.resource.getFilename();
}
public Resource getResource() {
// TODO Auto-generated method stub
return this.resource;
}
}
The audio is even working, but not properly, and when the view is loaded, always this exception is triggered:
I think there must be a problem related to wildFly 13 , because of the exception that is triggered when I try to create an instance of gwt audio.