Uses 29324K of libraries. Click here for Pure Java version (2694L/15K).
1 | !7 |
2 | |
3 | import java.nio.ByteBuffer; |
4 | import com.sedmelluq.discord.lavaplayer.player.*; |
5 | import com.sedmelluq.discord.lavaplayer.player.event.*; |
6 | import com.sedmelluq.discord.lavaplayer.demo.jda.TrackScheduler; |
7 | import com.sedmelluq.discord.lavaplayer.track.*; |
8 | import com.sedmelluq.discord.lavaplayer.track.playback.*; |
9 | import com.sedmelluq.discord.lavaplayer.source.*; |
10 | import com.sedmelluq.discord.lavaplayer.tools.*; |
11 | import com.sedmelluq.discord.lavaplayer.format.*; |
12 | |
13 | //lib 1400286 // lavaplayer 1.3.22 |
14 | lib 1400288 // lavaplayer fat |
15 | lib 1400289 // httpclient |
16 | lib 1400290 // httpcore |
17 | lib 1400291 // commons-io |
18 | lib 1400298 // lavaplayer libconnector.so |
19 | lib 1002510 // jsoup |
20 | lib 1400299 // apache-commons-logging |
21 | lib 1011966 // slf4j-api-1.7.25.jar |
22 | |
23 | cmodule PlayWithLava > DynPrintLog { |
24 | transient AudioPlayer player; |
25 | switchable S radioURL = "http://s3.free-shoutcast.com:18162/;?type=http&nocache=<RNDINT>"; |
26 | transient double bufferSeconds = 5.0; |
27 | transient CircularFifoBuffer buffer = new(iround(bufferSeconds*50)); |
28 | |
29 | start-thread { |
30 | AudioPlayerManager playerManager = lavaPlayer_playerManager(); |
31 | player = playerManager.createPlayer(); |
32 | lavaPlayer_printPlayerEvents(player); |
33 | print("Have player"); |
34 | lavaPlayer_loadItem(module(), playerManager, player, radioURL.replace("<RNDINT>", str(randomInt()))); |
35 | print("Track loaded"); |
36 | |
37 | doEvery(20, r { |
38 | temp enter(); |
39 | AudioFrame frame = player.provide(); |
40 | if (frame == null) print("no frame"); |
41 | else { |
42 | buffer.add(frame.getData()); |
43 | AudioDataFormat format = frame.getFormat(); |
44 | print("timecode: " + frame.getTimecode() |
45 | + ", length: " + frame.getDataLength() |
46 | + ", format: " + shortClassName(format) |
47 | + ", sampleRate: " + format.sampleRate + ", buf: " + buffer.size() + "/" + buffer.getBase()); |
48 | } |
49 | }); |
50 | } |
51 | |
52 | void cleanMeUp { |
53 | if (player != null) player.destroy(); |
54 | } |
55 | } |
Began life as a copy of #1025786
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025787 |
Snippet name: | Play with Lava AudioPlayer v2 |
Eternal ID of this version: | #1025787/4 |
Text MD5: | a13bd2993e3daec19c62946c8f820303 |
Transpilation MD5: | 216cb27e78de3efd0c36c9c67371ae4c |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-19 23:37:42 |
Source code size: | 1970 bytes / 55 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 214 / 332 |
Version history: | 3 change(s) |
Referenced in: | [show references] |