getDuration can be only called after prepared.

bug:5816130
Change-Id: I4f264ef612995bc4f7bc3e378893ed9491423fdc
This commit is contained in:
Teng-Hui Zhu
2012-01-04 17:15:46 -08:00
parent 7c48707a9d
commit 0d1d30b330

View File

@@ -311,7 +311,11 @@ class HTML5Audio extends Handler
}
private float getMaxTimeSeekable() {
return mMediaPlayer.getDuration() / 1000.0f;
if (mState >= PREPARED) {
return mMediaPlayer.getDuration() / 1000.0f;
} else {
return 0;
}
}
private native void nativeOnBuffering(int percent, int nativePointer);