SeekBar
을 내 비디오 앱에 연결했지만 바 끝까지 도달하지 못했습니다. 여기 코드는 다음과 같습니다Android SeekBar의 올바른 사용법은 무엇입니까?
videoSeekBar = (SeekBar) activity.findViewById(R.id.videoPlayerSeek);
videoDuration = player.getDuration();
videoSeekBar.setMax(videoDuration);
videoSeekBar.setProgress(0);
// Start lengthy operation in a background thread
new Thread(new Runnable() {
public void run() {
while (videoPlayProgress < videoDuration) {
videoPlayProgress = player.getCurrentPosition();
// Update the progress bar
handler.post(new Runnable() {
public void run() {
videoSeekBar.setProgress(videoPlayProgress);
}
});
}
}
}).start();
을 그리고, 내가 MediaPlayer를에 첨부 된 OnCompleteListener
있습니다. 그것은,
player.getCurrentPosition()
반환 6209
player.getDuration()
반환 맞지 않을 수
6592이라고합니다. 이 시점에서 슬라이더 상태 표시기는 슬라이더 막대 끝에 있지 않지만 약간의 간격이 있습니다. 동영상의 길이가 짧을수록 갭이 커집니다.
여기에있는 모든 내용이 제가 작성한 답변보다 낫습니다. – LeffelMania
안녕하세요 CommonsWare 귀하의 게시물은 매우 도움이됩니다. 그러나 나는 탐색 바를 바꿀 때 비디오가 부드럽게 움직 이도록해야합니다. 내 경우에는 탐색 막대를 움직이면 비디오가 중단되고 최신 위치로 이동합니다. 나를 안내 해줘. – Som