播放完后停在第一帧(缺少大小+再次播放逻辑)

This commit is contained in:
liujing
2020-10-19 21:03:58 +08:00
parent c418ac9a5a
commit afca3396fc
3 changed files with 47 additions and 18 deletions

View File

@@ -28,6 +28,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.HashMap;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@@ -645,7 +646,12 @@ public class BitmapHelper {
Bitmap b = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource( filePath );
retriever = new MediaMetadataRetriever();
if (Build.VERSION.SDK_INT >= 14)
retriever.setDataSource(filePath, new HashMap<String, String>());
else
retriever.setDataSource(filePath);
// mediaMetadataRetriever.setDataSource(videoPath);
b = retriever.getFrameAtTime();
} catch ( IllegalArgumentException e ) {
e.printStackTrace();