sclass JVideoLibDownloader is Swingable { transient SingleComponentPanel scp; selfType forward(IF0<JComponent> forward) { this.forward = forward; this; } swappable JComponent forward() { ret jcenteredlabel("Video extensions enabled"); } S libID() { ret ffmpegLibraryIDForPlatform(); } bool videoSupported() { ret libID() != null; } bool libDownloaded() { ret fileExists(DiskSnippetCache_getLibrary(libID())); } bool hasLib() { bool has = currentProgramHasLibrary(DiskSnippetCache_getLibrary(libID())); print("Video library ID: " + libID() + ", loaded: " + has); ret has; } void addLib() { if (videoSupported()) if (addLibraryToCurrentProgram(libID())) print("Video library loaded: " + libID()); } visualize { if (scp == null) scp = singleComponentPanel(makeComponent()); ret scp; } JComponent makeComponent() { if (!videoSupported()) ret jcenteredlabel("Video playback is not yet supported on your platform"); if (libDownloaded()) { addLib(); ret forward(); } else ret jfullcenter(centerAndEastWithMargin( jcenteredlabel("Download video player for " + platformName() + "(ca. 20 MB)?"), jbuttonWithDisable("OK", r addLibWithProgressBar))); } void addLibWithProgressBar { scp.setComponent(jcenteredlabel("Downloading extension...")); try { addLib(); scp.setComponent(forward()); } catch print e { scp.setComponent(jErrorView(e)); } } }
Began life as a copy of #1034410
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035135 |
Snippet name: | JVideoLibDownloader backup |
Eternal ID of this version: | #1035135/1 |
Text MD5: | f6618e30e0816c35af6e7ae3d0363171 |
Author: | stefan |
Category: | javax / video |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-30 22:52:29 |
Source code size: | 1622 bytes / 63 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 98 / 102 |
Referenced in: | [show references] |