com.sedmelluq.discord.lavaplayer.source.http.HttpAudioSourceManager Java Examples

The following examples show how to use com.sedmelluq.discord.lavaplayer.source.http.HttpAudioSourceManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Module.java    From kyoko with MIT License 6 votes vote down vote up
private void setupSourceManagers() {
    var youtubeAudioSourceManager = new YoutubeAudioSourceManager();
    musicManager.registerSourceManager(youtubeAudioSourceManager);
    musicManager.registerSourceManager(new SoundCloudAudioSourceManager());
    musicManager.registerSourceManager(new TwitchStreamAudioSourceManager());
    musicManager.registerSourceManager(new VimeoAudioSourceManager());
    musicManager.registerSourceManager(new BandcampAudioSourceManager());
    musicManager.registerSourceManager(new BeamAudioSourceManager());
    if (musicSettings.nico != null && musicSettings.nico.email != null && !musicSettings.nico.email.isEmpty()) {
        musicManager.registerSourceManager(new NicoAudioSourceManager(musicSettings.nico.email, musicSettings.nico.password));
    }

    if (musicSettings.spotify != null && musicSettings.spotify.id != null && musicSettings.spotify.secret != null) {
        musicManager.registerSourceManager(new SpotifyAudioSourceManager(musicSettings.spotify, youtubeAudioSourceManager));
    }

    if (musicSettings.httpWhitelist) {
        musicManager.registerSourceManager(new SafeHttpAudioSourceManager(registry));
    } else {
        musicManager.registerSourceManager(new HttpAudioSourceManager(registry));
    }
}
 
Example #2
Source File: AudioUtils.java    From SkyBot with GNU Affero General Public License v3.0 6 votes vote down vote up
public AudioUtils(DunctebotConfig.Apis config, Variables variables) {
    this.variables = variables;
    musicManagers = MapUtils.newLongObjectMap();

    playerManager = new UserContextAudioPlayerManager();
    //playerManager.enableGcMonitoring();

    final YoutubeAudioSourceManagerOverride youtubeAudioSourceManager = new YoutubeAudioSourceManagerOverride(
        variables.getYoutubeCache(),
        config.googl
    );

    playerManager.registerSourceManager(new SpotifyAudioSourceManager(youtubeAudioSourceManager, config));

    playerManager.registerSourceManager(youtubeAudioSourceManager);

    setCustomSourcesOn(playerManager, false);
    setCustomSourcesOn(LavalinkUtil.getPlayerManager(), true);

    playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
    playerManager.registerSourceManager(new BandcampAudioSourceManager());
    playerManager.registerSourceManager(new VimeoAudioSourceManager());
    playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
    playerManager.registerSourceManager(new BeamAudioSourceManager());
    playerManager.registerSourceManager(new HttpAudioSourceManager());
}
 
Example #3
Source File: BotApplicationManager.java    From lavaplayer with Apache License 2.0 6 votes vote down vote up
public BotApplicationManager() {
  guildContexts = new HashMap<>();
  controllerManager = new BotControllerManager();

  controllerManager.registerController(new MusicController.Factory());

  playerManager = new DefaultAudioPlayerManager();
  //playerManager.useRemoteNodes("localhost:8080");
  playerManager.getConfiguration().setResamplingQuality(AudioConfiguration.ResamplingQuality.LOW);
  playerManager.registerSourceManager(new YoutubeAudioSourceManager());
  playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
  playerManager.registerSourceManager(new BandcampAudioSourceManager());
  playerManager.registerSourceManager(new VimeoAudioSourceManager());
  playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
  playerManager.registerSourceManager(new BeamAudioSourceManager());
  playerManager.registerSourceManager(new HttpAudioSourceManager());
  playerManager.registerSourceManager(new LocalAudioSourceManager());

  executorService = Executors.newScheduledThreadPool(1, new DaemonThreadFactory("bot"));
}
 
Example #4
Source File: AudioSourceManagers.java    From lavaplayer with Apache License 2.0 5 votes vote down vote up
/**
 * Registers all built-in remote audio sources to the specified player manager. Local file audio source must be
 * registered separately.
 *
 * @param playerManager Player manager to register the source managers to
 * @param containerRegistry Media container registry to be used by any probing sources.
 */
public static void registerRemoteSources(AudioPlayerManager playerManager, MediaContainerRegistry containerRegistry) {
  playerManager.registerSourceManager(new YoutubeAudioSourceManager(true));
  playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault());
  playerManager.registerSourceManager(new BandcampAudioSourceManager());
  playerManager.registerSourceManager(new VimeoAudioSourceManager());
  playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
  playerManager.registerSourceManager(new BeamAudioSourceManager());
  playerManager.registerSourceManager(new GetyarnAudioSourceManager());
  playerManager.registerSourceManager(new HttpAudioSourceManager(containerRegistry));
}
 
Example #5
Source File: M3uPlaylistContainerProbe.java    From lavaplayer with Apache License 2.0 5 votes vote down vote up
@Override
public MediaContainerDetectionResult probe(AudioReference reference, SeekableInputStream inputStream) throws IOException {
  if (!checkNextBytes(inputStream, M3U_HEADER_TAG) && !checkNextBytes(inputStream, M3U_ENTRY_TAG)) {
    return null;
  }

  log.debug("Track {} is an M3U playlist file.", reference.identifier);
  String[] lines = DataFormatTools.streamToLines(inputStream, StandardCharsets.UTF_8);

  String hlsStreamUrl = HlsStreamSegmentUrlProvider.findHlsEntryUrl(lines);

  if (hlsStreamUrl != null) {
    AudioTrackInfoBuilder infoBuilder = AudioTrackInfoBuilder.create(reference, inputStream);
    AudioReference httpReference = HttpAudioSourceManager.getAsHttpReference(reference);

    if (httpReference != null) {
      return supportedFormat(this, TYPE_HLS_OUTER, infoBuilder.setIdentifier(httpReference.identifier).build());
    } else {
      return refer(this, new AudioReference(hlsStreamUrl, infoBuilder.getTitle(),
          new MediaContainerDescriptor(this, TYPE_HLS_INNER)));
    }
  }

  MediaContainerDetectionResult result = loadSingleItemPlaylist(lines);
  if (result != null) {
    return result;
  }

  return unsupportedFormat(this, "The playlist file contains no links.");
}
 
Example #6
Source File: PlayerControl.java    From Yui with Apache License 2.0 5 votes vote down vote up
public PlayerControl()
{
    java.util.logging.Logger.getLogger("org.apache.http.client.protocol.ResponseProcessCookies").setLevel(Level.OFF);

    this.playerManager = new DefaultAudioPlayerManager();
    playerManager.registerSourceManager(new YoutubeAudioSourceManager());
    playerManager.registerSourceManager(new SoundCloudAudioSourceManager());
    playerManager.registerSourceManager(new BandcampAudioSourceManager());
    playerManager.registerSourceManager(new VimeoAudioSourceManager());
    playerManager.registerSourceManager(new TwitchStreamAudioSourceManager());
    playerManager.registerSourceManager(new HttpAudioSourceManager());
    playerManager.registerSourceManager(new LocalAudioSourceManager());

    musicManagers = new HashMap<String, GuildMusicManager>();
}