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

57
LINES

< > BotCompany Repo | #1025786 // Play with Lava AudioPlayer

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 29324K of libraries. Click here for Pure Java version (2857L/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  
  
27  
  start-thread {
28  
    try {
29  
      AudioPlayerManager playerManager = lavaPlayer_playerManager();
30  
      player = playerManager.createPlayer();
31  
      lavaPlayer_printPlayerEvents(player);
32  
      print("Have player");
33  
      lavaPlayer_loadItem(module(), playerManager, player, radioURL.replace("<RNDINT>", str(randomInt())));
34  
      print("Track loaded");
35  
      
36  
      repeat 1000 {
37  
        AudioFrame frame = player.provide();
38  
        if (frame == null) print("no frame");
39  
        else {
40  
          AudioDataFormat format = frame.getFormat();
41  
          print("timecode: " + frame.getTimecode()
42  
          + ", length: " + frame.getDataLength()
43  
          + ", format: " + shortClassName(format)
44  
          + ", sampleRate: " + format.sampleRate);
45  
        }
46  
        sleep(10);
47  
      }
48  
    } finally {
49  
      if (player != null)
50  
        player.stopTrack();
51  
    }
52  
  }
53  
      
54  
  void cleanMeUp {
55  
    if (player != null) player.destroy();
56  
  }
57  
}

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: #1025786
Snippet name: Play with Lava AudioPlayer
Eternal ID of this version: #1025786/10
Text MD5: 634ee3276481ac634b0b389abfb0fde3
Transpilation MD5: 9531c2535534dd320de25d68274fc6a1
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:18:27
Source code size: 1888 bytes / 57 lines
Pitched / IR pitched: No / No
Views / Downloads: 213 / 368
Version history: 9 change(s)
Referenced in: [show references]