blob: c7f25eed370a9157d340359792c63d7c04233fd3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
package com.vaadin.tests.components.media;
import com.vaadin.server.ExternalResource;
import com.vaadin.shared.ui.PreloadMode;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Audio;
import com.vaadin.ui.Button;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Video;
public class Media extends TestBase {
@Override
protected void setup() {
final Video v = new Video("video");
v.setSources(new ExternalResource(
"http://techslides.com/demos/sample-videos/small.ogv"));
v.setWidth("560px");
v.setHeight("320px");
addComponent(v);
addComponent(new Button("Play video", event -> v.play()));
addComponent(new Button("Pause video", event -> v.pause()));
final CheckBox loop = new CheckBox("Loop");
loop.addValueChangeListener(event -> v.setLoop(event.getValue()));
addComponent(loop);
v.setPreload(PreloadMode.METADATA);
final Audio a = new Audio("audio");
a.setSources(new ExternalResource(
"http://www.sample-videos.com/audio/mp3/crowd-cheering.mp3"));
addComponent(a);
addComponent(new Button("Play audio", event -> a.play()));
addComponent(new Button("Pause audio", event -> a.pause()));
}
@Override
protected String getDescription() {
return "Video and audio files should play using the HTML5 elements. "
+ "(Movie is from http://techslides.com/sample-webm-ogg-and-mp4-video-files-for-html5)";
}
@Override
protected Integer getTicketNumber() {
return 6909;
}
}
|