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

29
LINES

< > BotCompany Repo | #1025345 // lavaPlayer_loadItem

JavaX fragment (include)

1  
// trackID = file path or URL (shoutcast etc)
2  
svoid lavaPlayer_loadItem(DynModule mod, AudioPlayerManager playerManager, AudioPlayer player, S trackID) {
3  
  playerManager.loadItem(print("Loading track: ", trackID), new AudioLoadResultHandler {
4  
    public void trackLoaded(AudioTrack track) {
5  
      temp dm_enter(mod);
6  
      //player.playTrack(track);
7  
      player.startTrack(track, false); // start with interrupting playing track
8  
      print("Started track " + track);
9  
    }
10  
  
11  
    public void playlistLoaded(AudioPlaylist playlist) {
12  
      temp dm_enter(mod);
13  
      print("Ignoring play list");
14  
      /*for (AudioTrack track : playlist.getTracks())
15  
        trackScheduler.queue(track);*/
16  
    }
17  
  
18  
    public void noMatches() {
19  
      temp dm_enter(mod);
20  
      print("Track " + trackID + ": no matches");
21  
    }
22  
    
23  
    public void loadFailed(FriendlyException e) {
24  
      temp dm_enter(mod);
25  
      print("Track " + trackID + " load failed: " + e);
26  
      printStackTrace(e);
27  
    }
28  
  });
29  
}

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: #1025345
Snippet name: lavaPlayer_loadItem
Eternal ID of this version: #1025345/5
Text MD5: 3397d335e291f5b98aad7368a9ea7762
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-26 17:41:29
Source code size: 1014 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 224 / 272
Version history: 4 change(s)
Referenced in: [show references]