只需在TextureView上使用mediaPlayer播放视频,但FPS低于videoView。有没有办法克服这个问题?
textureView = findViewById(R.id.textureView);
textureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
Surface s = new Surface(surfaceTexture);
try {
mMediaPlayer = new MediaPlayer();
mMediaPlayer.setDataSource(getApplicationContext(), uri);
mMediaPlayer.setSurface(s);
mMediaPlayer.prepare();
mMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mediaPlayer) {
mediaPlayer.setLooping(true);
}
});
mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mMediaPlayer.start();
if (textureView == null) {
textureView = new TextureView(getApplicationContext());
}
//adjustAspectRatio(mMediaPlayer.getVideoWidth(),mMediaPlayer.getVideoHeight());
} catch (Exception e) {
}
[经过稍微陈旧的电视设备测试。]
通过缓冲或更快地播放来提高FPS /帧速率的方法吗? 为此设置媒体加速是否有效?
或者我必须坚持使用更少的FPS?