2012-05-18 29 views
2

我正在做視頻錄製和保存記錄在我的文件夾內sdcard ..現在當我播放視頻從SD卡我想添加日期和時間在視頻視圖中,我完成圖像意味着能夠 使用幀佈局和Z-index在圖像視圖中添加時間戳記,但如何使用視頻錄製完成..是否有可能?如果有,請提出任何方式.. 我對圖片添加時間戳代碼給出以下refrence URL ...:是否有可能在錄製的視頻添加時間戳:android

http://www.ilovefreesoftware.com/29/android-2/how-to-auto-capture-date-and-time-on-photos-taken-from-android.html

現在如何爲視頻做同樣的事?

任何幫助將在這裏被大大apprciated ...

Bitmap src = BitmapFactory.decodeResource(getResources(), R.drawable.splashmodified); // the original file is cuty.jpg i added in resources 
    Bitmap dest = Bitmap.createBitmap(src.getWidth(), src.getHeight(), Bitmap.Config.ARGB_8888); 

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
    String dateTime = sdf.format(Calendar.getInstance().getTime()); // reading local time in the system 

    Canvas cs = new Canvas(dest); 
    Paint tPaint = new Paint(); 
    tPaint.setTextSize(35); 
    tPaint.setColor(Color.BLUE); 
    tPaint.setStyle(Style.FILL); 
    cs.drawBitmap(src, 0f, 0f, null); 
    float height = tPaint.measureText("yY"); 
    cs.drawText(dateTime, 20f, height+15f, tPaint); 
    try { 
     dest.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(new File("/sdcard/timeStampedImage.jpg"))); 
    } catch (FileNotFoundException e) { 
     // TODO Auto-generated catch block 
     e.printStackTrace(); 
    } 

} 

回答

0

如果你問如何簡單的視頻的頂部顯示的東西,答案是肯定...只是使用相對佈局並將您的TextView放置在您用於Camera預覽的SurfaceView相同的座標中,只要它位於XML中的SurfaceView之後,它將繪製在其上。

或者,如果您堅持要將文字繪製到畫布上,請將您的繪畫表面視圖放置在攝像機預覽的頂部。無論哪種方式,只要將它添加到凸輪表面之後的父視圖中,它將在其上繪製。

相關問題