Vaadin 8集成GwtAudio库播放音频触发RpcInvocationException异常求助
Vaadin 8音频播放功能的RPC异常问题
在Vaadin 8中使用audiovideo库实现音频播放功能,当前音频可正常播放,但加载视图时总会触发以下异常:GwtAudio RpcInvocationException: Unable to invoke method initialData in org.vaadin.gwtav.client.GwtAudioServerRpc
推测该异常可能与WildFly 13相关。
视图初始化代码
仅包含布局和GwtAudio实例:
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); }
ConnectorResource子类实现代码
用于创建GwtAudio所需的ConnectorAudio类:
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; } }
内容的提问来源于stack exchange,提问作者Álvaro Abad de Donesteve
相关产品推荐
相关产品推荐

