Skip to content

Commit 149537c

Browse files
author
Teng-Hui Zhu
committed
getDuration can be only called after prepared. DO NOT MERGE
bug:5816130 Change-Id: Ia740a1a4da7f321356f24c35067f9499955289a9
1 parent dacbf67 commit 149537c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/java/android/webkit/HTML5Audio.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ private void teardown() {
311311
}
312312

313313
private float getMaxTimeSeekable() {
314-
return mMediaPlayer.getDuration() / 1000.0f;
314+
if (mState >= PREPARED) {
315+
return mMediaPlayer.getDuration() / 1000.0f;
316+
} else {
317+
return 0;
318+
}
315319
}
316320

317321
private native void nativeOnBuffering(int percent, int nativePointer);

0 commit comments

Comments
 (0)