在Gallery 这支ap里我们可以看到有对视频video显示,其源代码如下:
public static Bitmap createVideoThumbnail(String filePath) {
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY);
retriever.setDataSource(filePath);
bitmap = retriever.captureFrame();
} catch (IllegalArgumentException ex) {
// Assume this is a corrupt video file
} catch (RuntimeException ex) {
// Assume this is a corrupt video file.
} finally {
try {
retriever.release();
} catch (RuntimeException ex) {
// Ignore failures while cleaning up.
}
}
return bitmap;
}/code]
问题:
MediaMetadataRetriever如何才能被AP调用呢?它位于frameworks/base/media/java/android/media/MediaMetadataRetriever.java
[email protected]?那如何操作重新编译Frameworks才能被AP使用呢?
1 楼 yanx730 2010-11-03
2 楼 sky83119 2011-07-11
我想问个问题,这个方法是不是只适用于MP4和3gp,其他格式的视频文件都不支持吧
3 楼 追求幸福 2011-07-14
sky83119 写道
我想问个问题,这个方法是不是只适用于MP4和3gp,其他格式的视频文件都不支持吧
我没进入深入了解哦!只是看过android 1.5的ap层而已。