简易视频播放器
简易视频播放器<div class="postbody"><div id="cnblogs_post_body">比较不错的源码:
倒计时的实现方案 - 类似限时抢购商品等
http://www.eoeandroid.com/thread-231924-1-1.html
android 仿IPHONE桌面图标抖动
http://www.eoeandroid.com/thread-231330-1-1.html
Android中如何使用ViewPager实现类似laucher左右拖动效果
http://www.eoeandroid.com/thread-231368-1-1.html
eoe积分商城:
http://www.eoeandroid.com/plugin.php?id=auction
-----------------帖子正文-------------------------
为了熟悉android视频方面的api,结合论坛里的资料,动手写了一个调用系统API的视频播放器,只能播放系统自带能解码的格式,界面比较简单,如下图:
http://pic002.cnblogs.com/images/2012/68062/2012112611172959.png
代码主要有两个部分:
1.搜索手机中所有视频并显示
主要通过以下代码实现:
<div class="cnblogs_code">cursor = getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, mediaColumns, null, null, null); if(cursor.moveToFirst()){ do{ VideoInfo info = new VideoInfo(); info.filePath = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)); info.mimeType = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE)); info.title = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE)); Log.d("-name debug-", info.title+" "+info.filePath); //获取当前Video对应的Id,然后根据该ID获取其Thumb int id = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID)); BitmapFactory.Options options = new BitmapFactory.Options(); options.inDither = false; options.inPreferredConfig = Bitmap.Config.ARGB_8888; info.b = MediaStore.Video.Thumbnails.getThumbnail(getContentResolver(), id,Images.Thumbnails.MICRO_KIND, options); //然后将其加入到videoList videoList.add(info); }while(cursor.moveToNext()); }
页:
[1]