我在我的 vaadin 应用程序中创建了一个用 @tag('video') 注释的自定义类。 海报、控件、自动播放、src、宽度等所需属性已定义,并且一切正常。 现在我需要为类定义 play() 和 pause() 方法,这样我就可以以编程方式使用它们。
注意:课程像 html 中的视频一样。
@Tag("video")
public class Video extends Component implements ClickNotifier{
protected String getVideoSourceAttributeName() {
return VideoAttributes.Source;
}
public void setWidth(String width) {
this.getElement().setAttribute(VideoAttributes.Width, width);
}
public void setHeight(String height) {
this.getElement().setAttribute(VideoAttributes.Height, height);
}
private interface VideoAttributes {
String Controls = "controls";
String Source = "src";
String CurrentTime = "currentTime";
String AutoPlay = "autoplay";
String Loop = "loop";
String Preload = "preload";
String Poster = "poster";
String Width = "width";
String Height = "height";
}
public interface functions {
}
}