当前位置: 首页>>代码示例>>Java>>正文


Java AudioTrack.getDuration方法代码示例

本文整理汇总了Java中com.sedmelluq.discord.lavaplayer.track.AudioTrack.getDuration方法的典型用法代码示例。如果您正苦于以下问题:Java AudioTrack.getDuration方法的具体用法?Java AudioTrack.getDuration怎么用?Java AudioTrack.getDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sedmelluq.discord.lavaplayer.track.AudioTrack的用法示例。


在下文中一共展示了AudioTrack.getDuration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInternal

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
@Override
protected boolean doInternal(MessageReceivedEvent message, TrackRequest request, long millis) {
    AudioTrack track = request.getTrack();
    long duration = track.getDuration();
    long position = track.getPosition();

    millis = Math.min(duration - position, millis);

    if (playerService.getInstance(message.getGuild()).seek(position + millis)) {
        messageManager.onMessage(message.getChannel(), "discord.command.audio.forward",
                messageManager.getTitle(track.getInfo()), CommonUtils.formatDuration(millis));
        request.setResetMessage(true);
    }
    return ok(message);
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:16,代码来源:ForwardCommand.java

示例2: doInternal

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
@Override
protected boolean doInternal(MessageReceivedEvent message, TrackRequest request, long millis) {
    AudioTrack track = request.getTrack();
    long duration = track.getDuration();
    millis = Math.min(duration, millis);
    if (playerService.getInstance(message.getGuild()).seek(millis)) {
        messageManager.onMessage(message.getChannel(), "discord.command.audio.seek",
                messageManager.getTitle(track.getInfo()), CommonUtils.formatDuration(millis));
        request.setResetMessage(true);
    }
    return true;
}
 
开发者ID:GoldRenard,项目名称:JuniperBotJ,代码行数:13,代码来源:SeekCommand.java

示例3: isSongTooLong

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
public static boolean isSongTooLong(AudioTrack track) {
    return track.getDuration() >= MAX_DURATION * 1000;
}
 
开发者ID:JessWalters,项目名称:Vinny-Redux,代码行数:4,代码来源:VoiceSendHandler.java

示例4: execute

import com.sedmelluq.discord.lavaplayer.track.AudioTrack; //导入方法依赖的package包/类
public void execute(GuildMessageReceivedEvent e, String query) {

        final AudioHandler player = JukeBot.getPlayer(e.getGuild().getAudioManager());
        final AudioTrack currentTrack = player.player.getPlayingTrack();

        if (!player.isPlaying()) {
            e.getChannel().sendMessage(new EmbedBuilder()
                    .setColor(JukeBot.embedColour)
                    .setTitle("No playback activity")
                    .setDescription("There's nothing playing.")
                    .build()
            ).queue();
            return;
        }

        if (!permissions.isElevatedUser(e.getMember(), true)) {
            e.getChannel().sendMessage(new EmbedBuilder()
                    .setColor(JukeBot.embedColour)
                    .setTitle("Permission Error")
                    .setDescription("You need to be a DJ")
                    .build()
            ).queue();
            return;
        }

        if (!currentTrack.isSeekable()) {
            e.getChannel().sendMessage(new EmbedBuilder()
                    .setColor(JukeBot.embedColour)
                    .setTitle("Unable to Seek")
                    .setDescription("The currently playing track doesn't support seeking.")
                    .build()
            ).queue();
            return;
        }

        int forwardTime = Helpers.parseNumber(query, 10) * 1000;

        if (currentTrack.getPosition() + forwardTime >= currentTrack.getDuration()) {
            player.playNext();
            return;
        }

        currentTrack.setPosition(currentTrack.getPosition() + forwardTime);
        e.getChannel().sendMessage(new EmbedBuilder()
                .setColor(JukeBot.embedColour)
                .setTitle("Track Seeking")
                .setDescription("The current track has been moved to **" + Helpers.fTime(currentTrack.getPosition()) + "**")
                .build()
        ).queue();

    }
 
开发者ID:Devoxin,项目名称:JukeBot,代码行数:52,代码来源:Seek.java


注:本文中的com.sedmelluq.discord.lavaplayer.track.AudioTrack.getDuration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。