MediaPlayer和Android 4.4的问题

时间:2014-01-09 16:49:37

标签: android android-mediaplayer

我正在开发流媒体视频应用。在Android 4.0-4.3中视频在3-5秒内启动,但我不知道Android 4.4+启动时发生的事情超过20秒。任何修复或黑客攻击?

private void playVideo(String url) {
    doCleanUp();
    try {

        // Create a new media player and set the listeners
        mMediaPlayer = new MediaPlayer();
        mMediaPlayer.setWakeMode(getApplicationContext(),    PowerManager.PARTIAL_WAKE_LOCK);
        mMediaPlayer.setOnPreparedListener(mOnPreparedListener);
        mMediaPlayer.setOnVideoSizeChangedListener(mOnVideoSizeChangedListener);
        mMediaPlayer.setOnCompletionListener(mOnCompletionListener);
        mMediaPlayer.setOnBufferingUpdateListener(mOnBufferingUpdateListener);
        //mMediaPlayer.setDataSource(mVideoPath2);
        //wifiLock.acquire();
        mMediaPlayer.setDataSource(url);
        mMediaPlayer.setDisplay(mVideoSurfaceViewHolder);
        mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
        mMediaPlayer.setScreenOnWhilePlaying(true);
        mMediaPlayer.prepareAsync();
    } catch (Exception e) {
        Log.e(TAG, "error: " + e.getMessage(), e);
    }
}
  • prepareAsync()被称为
  • 然后在2秒内onPrepare()回调 但视频在4.4秒内开始超过20秒。在android 4.3中开始3秒......

错误? https://code.google.com/p/android/issues/detail?id=62304 任何修复/黑客?

0 个答案:

没有答案