如何定义方法:Vaadin 视频中的 play() 和 pause()

问题描述 投票:0回答:0

我在我的 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 {

}

}
java vaadin
© www.soinside.com 2019 - 2024. All rights reserved.