java - ExoPlayer 设置命令找不到 UNKNOWN_TIME

标签 java android duration exoplayer2.x

我正在尝试设置 exoPlayer 的命令,但我不知道如何设置

getDuration();
getCurrentPosition();

我发现了这个,但我必须在UNKNOWN_TIME上设置,因为它告诉我无法解析符号UNKNOWN_TIME

@Override
public int getCurrentPosition() {
    return exoPlayer.getDuration() == ExoPlayer.UNKNOWN_TIME ? 0
            : (int) exoPlayer.getCurrentPosition();
}

@Override
public int getDuration() {
    return exoPlayer.getDuration() == ExoPlayer.UNKNOWN_TIME ? 0
            : (int) exoPlayer.getDuration();
}

最佳答案

对于 ExoPlayer 2.0,您应该使用 C.TIME_UNSET 常量(来自 com.google.android.exoplayer2 包)而不是 ExoPlayer.UNKNOWN_TIME (请参阅 getDuration() 方法的说明适用于 ExoPlayer 2.0。

关于java - ExoPlayer 设置命令找不到 UNKNOWN_TIME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41832578/

相关文章:

java - 在 ArrayList Java 中操作字符串

Java 检查端口是否打开且可供其他计算机访问

java - parse.com - 使用 .include() 查询检索数组数据有多深?

java - 如何通过java使用selenium部分查找xpath元素?

android - picasso 加载字节数组

android - Qt Creator 和 Android 在模拟器上运行但在硬件设备上崩溃

php - 如何根据服务时间禁用时段?

iOS-如何使用 AVAsset 或 AVURLAsset 获取 .mp4 文件的持续时间

android - Proguard 吃了我的 Object.wait()

c++ - 将持续时间值设为双倍