Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDuration()返回的长度是0,seekTo()没法使用,iOS的vlc可以使用,虽然返回的时长都是0,这个能支持一下吗 #188

Open
zijin2014 opened this issue Mar 31, 2021 · 1 comment

Comments

@zijin2014
Copy link

No description provided.

@ILoveLin
Copy link

在VlcPlayer这个类中onEventNative方法的case MediaPlayer.Event.TimeChanged:的时候可以获取到
` String t = event.getTimeChanged() + "";
只是需要吧获取到的时间长度格式化已下

/**
 * 将长度转换为时间
 *
 * @param timeMs
 * @return
 */

public static String stringForTime(int timeMs) {  //18565
    StringBuilder mFormatBuilder = new StringBuilder();
    Formatter mFormatter = new Formatter(mFormatBuilder, Locale.getDefault());
    int totalSeconds = timeMs / 1000;
    int seconds = totalSeconds % 60;
    int minutes = (totalSeconds / 60) % 60;
    int hours = totalSeconds / 3600;
    mFormatBuilder.setLength(0);
    if (hours > 0) {
        return mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString();
    } else {
        return mFormatter.format("%02d:%02d", minutes, seconds).toString();
    }





}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants