Uses 0K of libraries. Click here for Pure Java version (14505L/102K).
1 | !7 |
2 | |
3 | static LS _stickyLibs_vlcj = ll(#1400035); |
4 | lib 1400035 // vlcj player |
5 | |
6 | import uk.co.caprica.vlcjplayer.Application; |
7 | import uk.co.caprica.vlcjplayer.event.*; |
8 | import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent; |
9 | import uk.co.caprica.vlcj.player.embedded.EmbeddedMediaPlayer; |
10 | import uk.co.caprica.vlcj.discovery.NativeDiscovery; |
11 | import uk.co.caprica.vlcj.log.NativeLog; |
12 | import uk.co.caprica.vlcj.runtime.RuntimeUtil; |
13 | import uk.co.caprica.vlcj.runtime.streams.NativeStreams; |
14 | |
15 | module VLCJTest > DynSCP { |
16 | transient EmbeddedMediaPlayerComponent mediaPlayerComponent; |
17 | transient EmbeddedMediaPlayer mediaPlayer; |
18 | transient float position; |
19 | |
20 | start { |
21 | doEvery(1000, r { |
22 | if (mediaPlayer != null) |
23 | if (setField(position := mediaPlayer.getPosition())) |
24 | print("Video position: " + position); |
25 | }); |
26 | } |
27 | |
28 | JComponent visualize2() { |
29 | ret jcenteredbutton("Play a video...", r { |
30 | selectFile("Video to play", voidfunc(final File f) { thread { playVideo(f); } }) |
31 | }); |
32 | } |
33 | |
34 | void playVideo(final File f) { |
35 | temp enter(); |
36 | |
37 | // This will locate LibVLC for the vast majority of cases |
38 | new NativeDiscovery().discover(); |
39 | |
40 | mediaPlayerComponent = Application.application().mediaPlayerComponent(); |
41 | setComponent(centerAndSouth(mediaPlayerComponent, |
42 | withMargin(centeredButtons( |
43 | "Play", r { if (mediaPlayer != null) mediaPlayer.play() }, |
44 | "Pause", r { if (mediaPlayer != null) mediaPlayer.pause() }, |
45 | "Stop", r { if (mediaPlayer != null) mediaPlayer.stop() }, |
46 | )))); |
47 | |
48 | mediaPlayer = mediaPlayerComponent.getMediaPlayer(); |
49 | |
50 | swing { |
51 | mediaPlayer.playMedia(f2s(f)); |
52 | mediaPlayer.play(); |
53 | mediaPlayer.setVolume(100); |
54 | print("Audio descriptions: " + mediaPlayer.getAudioDescriptions()); |
55 | } |
56 | } |
57 | |
58 | void cleanMeUp_vlcj { |
59 | if (mediaPlayer != null) { |
60 | mediaPlayer.release(); |
61 | mediaPlayer = null; |
62 | } |
63 | } |
64 | } |
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019320 |
Snippet name: | VLCJ Video Surface Test [Dyn Module, sometimes works (why?), needs VLC installed] |
Eternal ID of this version: | #1019320/27 |
Text MD5: | 458e95daafa1940ac209c35c104b3b39 |
Transpilation MD5: | 4b08748ba132ffccf8c9da5ca34c7765 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-11 01:49:42 |
Source code size: | 2005 bytes / 64 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 461 / 1242 |
Version history: | 26 change(s) |
Referenced in: | [show references] |