@@ -25,19 +25,15 @@ padding. The audio samples are always encoded in **Signed PCM 16-bit Little-Endi
25
25
```
26
26
27
27
``` java
28
- final AudioPipelineStep audioPipelineStep = ... ;
29
- final VideoPipelineStep videoPipelineStep = ... ;
30
- final FileSource videoSource = ... ;
31
- final FileSource audioSource = ... ;
32
- final VideoPlayerMultiplexer multiplexer = VideoPlayer . vlc();
33
- // audioPipelineStep and videoPipelineStep from above
34
- multiplexer.
35
-
36
- start(audioPipelineStep, videoPipelineStep, videoSource, audioSource);
37
- // ... do something with the player
38
- multiplexer.
39
-
40
- release();
28
+ final AudioPipelineStep audioPipelineStep = ... ;
29
+ final VideoPipelineStep videoPipelineStep = ... ;
30
+ final FileSource videoSource = ... ;
31
+ final FileSource audioSource = ... ;
32
+ final VideoPlayerMultiplexer multiplexer = VideoPlayer . vlc();
33
+ // audioPipelineStep and videoPipelineStep from above
34
+ multiplexer. start(audioPipelineStep, videoPipelineStep, videoSource, audioSource);
35
+ // ... do something with the player
36
+ multiplexer. release();
41
37
```
42
38
43
39
``` {warning}
@@ -49,18 +45,14 @@ All multiplexer players support single input video and audio sources. For exampl
49
45
so.
50
46
51
47
``` java
52
- final AudioPipelineStep audioPipelineStep = ... ;
53
- final VideoPipelineStep videoPipelineStep = ... ;
54
- final FileSource source = ... ;
55
- final VideoPlayerMultiplexer player = VideoPlayer . vlc();
56
- // audioPipelineStep and videoPipelineStep from above
57
- player.
58
-
59
- start(audioPipelineStep, videoPipelineStep, source);
60
- // ... do something with the player
61
- player.
62
-
63
- release();
48
+ final AudioPipelineStep audioPipelineStep = ... ;
49
+ final VideoPipelineStep videoPipelineStep = ... ;
50
+ final FileSource source = ... ;
51
+ final VideoPlayerMultiplexer player = VideoPlayer . vlc();
52
+ // audioPipelineStep and videoPipelineStep from above
53
+ player. start(audioPipelineStep, videoPipelineStep, source);
54
+ // ... do something with the player
55
+ player. release();
64
56
```
65
57
66
58
The ` VLCPlayer ` , ` FFmpegPlayer ` , ` VideoInputPlayer ` , and ` OpenCVPlayer ` are all multiplexer video players.
@@ -79,16 +71,12 @@ To use the `ChromeDriverPlayer`, you must have a `BrowserSource` that specifies
79
71
80
72
``` java
81
73
final VideoPipelineStep videoPipelineStep = ... ;
82
- final VideoMetadata metadata = VideoMetadata . of(1920 , 1080 ); // specify browser resolution
83
- final BrowserSource browserSource = BrowserSource . of(URI . create(" https://example.com" ), metadata);
84
- final BrowserPlayer player = BrowserPlayer . defaultChrome(); // starts Chrome WebDriver with default arguments
85
- player.
86
-
87
- start(videoPipelineStep, browserSource);
88
- // ... do something with the player
89
- player.
90
-
91
- release();
74
+ final VideoMetadata metadata = VideoMetadata . of(1920 , 1080 ); // specify browser resolution
75
+ final BrowserSource browserSource = BrowserSource . of(URI . create(" https://example.com" ), metadata);
76
+ final BrowserPlayer player = BrowserPlayer . defaultChrome(); // starts Chrome WebDriver with default arguments
77
+ player. start(videoPipelineStep, browserSource);
78
+ // ... do something with the player
79
+ player. release();
92
80
```
93
81
94
82
## Image Players
@@ -99,32 +87,24 @@ JFreeChart chart and displaying it.
99
87
100
88
``` java
101
89
final VideoPipelineStep videoPipelineStep = ... ;
102
- final FrameSource frameSource = FrameSource . image(... ); // provide your frames in a supplier
103
- final ImagePlayer player = ImagePlayer . player();
104
- player.
105
-
106
- start(videoPipelineStep, frameSource);
107
- // ... do something with the player
108
- player.
109
-
110
- release();
90
+ final FrameSource frameSource = FrameSource . image(... ); // provide your frames in a supplier
91
+ final ImagePlayer player = ImagePlayer . player();
92
+ player. start(videoPipelineStep, frameSource);
93
+ // ... do something with the player
94
+ player. release();
111
95
```
112
96
113
97
If you want to play a GIF image, you can use the ` RepeatingFrameSource ` which accepts any ` DynamicImage ` . You can pass
114
98
this into ` ImagePlayer ` directly.
115
99
116
100
``` java
117
101
final VideoPipelineStep videoPipelineStep = ... ;
118
- final DynamicImage gif = DynamicImage . path(FileSource . path(Path . of(" example.gif" ))); // provide your gif image
119
- final RepeatingFrameSource frameSource = RepeatingFrameSource . repeating(gif); // provide your gif frames in a supplier
120
- final ImagePlayer player = ImagePlayer . player();
121
- player.
122
-
123
- start(videoPipelineStep, frameSource);
124
- // ... do something with the player
125
- player.
126
-
127
- release();
102
+ final DynamicImage gif = DynamicImage . path(FileSource . path(Path . of(" example.gif" ))); // provide your gif image
103
+ final RepeatingFrameSource frameSource = RepeatingFrameSource . repeating(gif); // provide your gif frames in a supplier
104
+ final ImagePlayer player = ImagePlayer . player();
105
+ player. start(videoPipelineStep, frameSource);
106
+ // ... do something with the player
107
+ player. release();
128
108
```
129
109
130
110
This will play the GIF indefinitely until you stop the player. You're also welcome to play the GIF in the
@@ -139,21 +119,17 @@ a `VNCSource`, and pass it to the player.
139
119
140
120
``` java
141
121
final VideoPipelineStep pipeline = ... ;
142
- final VNCSource source = VNCSource . vnc()
143
- .host(" localhost" )
144
- .port(5900 )
145
- .password(" passwd" )
146
- .videoMetadata(videoMetadata)
147
- .name(" VNC Connection" )
148
- .build();
149
- final VNCPlayer player = VNCPlayer . vm();
150
- player.
151
-
152
- start(pipeline, source);
153
- // ... do some play back
154
- player.
155
-
156
- release();
122
+ final VNCSource source = VNCSource . vnc()
123
+ .host(" localhost" )
124
+ .port(5900 )
125
+ .password(" passwd" )
126
+ .videoMetadata(videoMetadata)
127
+ .name(" VNC Connection" )
128
+ .build();
129
+ final VNCPlayer player = VNCPlayer . vm();
130
+ player. start(pipeline, source);
131
+ // ... do some play back
132
+ player. release();
157
133
```
158
134
159
135
That way, you're able to connect to virtual machines or any VNC server and interact with it as if it were a local
0 commit comments