Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

80
LINES

< > BotCompany Repo | #1033431 // VLCJ Player v2 (testing with new VLCJ version)

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 383K of libraries. Compilation Failed (8103L/47K).

1  
!7
2  
3  
lib 1400522 // vlcj player
4  
5  
import static uk.co.caprica.vlcjplayer.Application.application;
6  
7  
import uk.co.caprica.vlcj.player.embedded.*;
8  
import uk.co.caprica.vlcjplayer.event.*;
9  
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
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  
import uk.co.caprica.vlcjplayer.view.debug.DebugFrame;
15  
import uk.co.caprica.vlcjplayer.view.effects.EffectsFrame;
16  
import uk.co.caprica.vlcjplayer.view.main.MainFrame;
17  
import uk.co.caprica.vlcjplayer.view.messages.NativeLogFrame;
18  
19  
static NativeStreams nativeStreams;
20  
static JFrame mainFrame, messagesFrame, effectsFrame, debugFrame;
21  
static NativeLog nativeLog;
22  
23  
p/*-subst*/ { // fullscreen still has a frame with Substance
24  
  pnl(addMegaLibrary(myClassLoader(), #1400524);
25  
  fixContextClassLoader();
26  
  
27  
  // This will locate LibVLC for the vast majority of cases
28  
  new NativeDiscovery().discover();
29  
  startPlayer();
30  
  
31  
  if (nempty(args)) {
32  
    S fileToPlay = first(args);
33  
    if (fileExists(fileToPlay)) {
34  
      application().addRecentMedia(fileToPlay);
35  
      application().mediaPlayerComponent().getMediaPlayer().playMedia(fileToPlay);
36  
    }
37  
  }
38  
  
39  
  hideConsole();
40  
}
41  
42  
svoid startPlayer {
43  
  swing {
44  
    final EmbeddedMediaPlayerComponent mediaPlayerComponent = application().mediaPlayerComponent();
45  
  
46  
    mainFrame = new MainFrame();
47  
    onWindowClosingDoOnly(mainFrame, r {
48  
      mediaPlayerComponent.getMediaPlayer().stop();
49  
      mediaPlayerComponent.release();
50  
      if (nativeStreams != null) nativeStreams.release();
51  
      application().post(ShutdownEvent.INSTANCE);
52  
      cleanKillInNewThread();
53  
    });
54  
    
55  
    EmbeddedMediaPlayer embeddedMediaPlayer = mediaPlayerComponent.getMediaPlayer();
56  
    embeddedMediaPlayer.setFullScreenStrategy(new VlcjPlayerFullScreenStrategy(mainFrame));
57  
58  
    nativeLog = mediaPlayerComponent.getMediaPlayerFactory().newLog();
59  
60  
    messagesFrame = new NativeLogFrame(nativeLog);
61  
    effectsFrame = new EffectsFrame();
62  
    debugFrame = new DebugFrame();
63  
    
64  
    mainFrame.setVisible(true);
65  
  }
66  
}
67  
68  
sclass VlcjPlayerFullScreenStrategy extends DefaultAdaptiveRuntimeFullScreenStrategy {
69  
  *(Window window) { super(window); }
70  
71  
  @Override
72  
  protected void beforeEnterFullScreen() {
73  
      application().post(BeforeEnterFullScreenEvent.INSTANCE);
74  
  }
75  
76  
  @Override
77  
  protected  void afterExitFullScreen() {
78  
      application().post(AfterExitFullScreenEvent.INSTANCE);
79  
  }
80  
}

Author comment

Began life as a copy of #1016320

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): bhatertpkbcr, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033431
Snippet name: VLCJ Player v2 (testing with new VLCJ version)
Eternal ID of this version: #1033431/1
Text MD5: 7d55dd6640c6d35913f8730a1fc45c54
Transpilation MD5: 9033b308301744d619d5a4f9734c08b0
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-27 13:47:24
Source code size: 2633 bytes / 80 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 755
Referenced in: [show references]