本文整理了Java中android.media.MediaMetadataRetriever.release()
方法的一些代码示例,展示了MediaMetadataRetriever.release()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaMetadataRetriever.release()
方法的具体详情如下:
包路径:android.media.MediaMetadataRetriever
类名称:MediaMetadataRetriever
方法名:release
暂无
代码示例
代码示例来源:origin: CarGuo/GSYVideoPlayer
@Override
protected void onDestroy() {
super.onDestroy();
isRelease = true;
if (isPlay) {
getCurPlay().release();
}
//GSYPreViewManager.instance().releaseMediaPlayer();
if (orientationUtils != null)
orientationUtils.releaseListener();
if (mCoverMedia != null) {
mCoverMedia.release();
mCoverMedia = null;
}
}
代码示例来源:origin: stackoverflow.com
// load data file
MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever();
metaRetriever.setDataSource(filePath);
String out = "";
// get mp3 info
// convert duration to minute:seconds
String duration =
metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
Log.v("time", duration);
long dur = Long.parseLong(duration);
String secOnds= String.valueOf((dur % 60000) / 1000);
Log.v("seconds", seconds);
String minutes = String.valueOf(dur / 60000);
out = minutes + ":" + seconds;
if (seconds.length() == 1) {
txtTime.setText("0" + minutes + ":0" + seconds);
}else {
txtTime.setText("0" + minutes + ":" + seconds);
}
Log.v("minutes", minutes);
// close object
metaRetriever.release();
代码示例来源:origin: bumptech/glide
mediaMetadataRetriever.release();
代码示例来源:origin: stackoverflow.com
mediaMetadataRetriever.release();
代码示例来源:origin: bumptech/glide
@Test
public void testReleasesMediaMetadataRetriever() throws IOException {
Util.setSdkVersionInt(19);
decoder.decode(resource, 1, 2, options);
verify(retriever).release();
}
代码示例来源:origin: stackoverflow.com
public static Bitmap getVideoFrame(FileDescriptor FD) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(FD);
return retriever.getFrameAtTime();
} catch (IllegalArgumentException ex) {
ex.printStackTrace();
} catch (RuntimeException ex) {
ex.printStackTrace();
} finally {
try {
retriever.release();
} catch (RuntimeException ex) {
}
}
return null;
}
代码示例来源:origin: mayubao/KuaiChuan
/**
* @Description 获取专辑封面
* @param filePath 文件路径,like XXX/XXX/XX.mp3
* @return 专辑封面bitmap
*/
public static Bitmap createAlbumArt(final String filePath) {
Bitmap bitmap = null;
//能够获取多媒体文件元数据的类
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(filePath); //设置数据源
byte[] embedPic = retriever.getEmbeddedPicture(); //得到字节型数据
bitmap = BitmapFactory.decodeByteArray(embedPic, 0, embedPic.length); //转换为图片
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
retriever.release();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return bitmap;
}
代码示例来源:origin: guolindev/giffun
@Override
public Bitmap decode(ParcelFileDescriptor resource, BitmapPool bitmapPool, int outWidth, int outHeight,
DecodeFormat decodeFormat)
throws IOException {
MediaMetadataRetriever mediaMetadataRetriever = factory.build();
mediaMetadataRetriever.setDataSource(resource.getFileDescriptor());
Bitmap result;
if (frame >= 0) {
result = mediaMetadataRetriever.getFrameAtTime(frame);
} else {
result = mediaMetadataRetriever.getFrameAtTime();
}
mediaMetadataRetriever.release();
resource.close();
return result;
}
代码示例来源:origin: ta893115871/VideoEdit
public void release() {
if (mMetadataRetriever != null) {
mMetadataRetriever.release();
}
}
代码示例来源:origin: LLhon/Android-Video-Editor
public void release() {
if (mMetadataRetriever != null) {
mMetadataRetriever.release();
}
}
代码示例来源:origin: ta893115871/MediaMetadataRetrieverDemo
public void release() {
if (mMetadataRetriever != null) {
mMetadataRetriever.release();
}
}
代码示例来源:origin: Reone/Mrthumb
@Override
public void release() {
this.mRetriever.release();
}
}
代码示例来源:origin: stackoverflow.com
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource("/path/to/video.mp4");
int width = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
int height = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
retriever.release();
代码示例来源:origin: stackoverflow.com
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(uriOfFile);
int width = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
int height = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
retriever.release();
代码示例来源:origin: stackoverflow.com
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(mPath);
InputStream inputStream = null;
if (mmr.getEmbeddedPicture() != null) {
inputStream = new ByteArrayInputStream(mmr.getEmbeddedPicture());
}
mmr.release();
bitmap = BitmapFactory.decodeStream(inputStream);
代码示例来源:origin: stackoverflow.com
String mediaPath = Uri.parse("android.resource:///raw/filename").getPath();
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(mediaPath);
String duration = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
mmr.release();
代码示例来源:origin: stackoverflow.com
MediaMetadataRetriever met = new MediaMetadataRetriever();
try {
met.setDataSource(data[0], new HashMap()); //use this constructor, other one has a bug...
Bitmap b = met.getFrameAtTime();
if (b == null)
b = met.getFrameAtTime(150, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
met.release();
return b;
} catch (Exception e) {
Log.d(TAG, "MediaMetadata failed", e);
}
代码示例来源:origin: LLhon/Android-Video-Editor
private Resolution getVideoResolution(final String path, final int rotation) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(path);
int width = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH));
int height = Integer.valueOf(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT));
retriever.release();
return new Resolution(width, height);
}
代码示例来源:origin: shutup/android-ffmpeg-java-demo
public static Bitmap getVideoFrame(String videoPath,long frameTime) throws Exception {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(videoPath);
return retriever.getFrameAtTime(frameTime, MediaMetadataRetriever.OPTION_CLOSEST);
} finally {
try {
retriever.release();
} catch (RuntimeException ex) {
}
}
}
}
代码示例来源:origin: stackoverflow.com
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
for (int i = 0; i mmr.setDataSource(files[i]);
mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
Bitmap b = mmr.getFrameAtTime(2000000, MediaMetadataRetriever.OPTION_CLOSEST); // frame at 2 seconds
byte [] artwork = mmr.getEmbeddedPicture();
}
mmr.release(); // all done, release the object