android - Get system time in millisecond using Buttons while recording video -


i recording video using camera2api button start recording.now when recording starts, need system time in milliseconds if press specific button(other start rec button ) .

if not system time, @ least record time of video being recorded.

the time should stored if press specific button. have tried using system.currenttimemillis() , systemclock.elapsedtime(), once recording starts , press specific button record time without stopping recorded ,it doesn't store time details , shows 0.

below code using store time:

case r.id.video: {             if (misrecordingvideo) {                 stoprecordingvideo();             } else {                 starttsrecordingvideo();                 starttime = system.currenttimemillis();                 log.d(tag, "onclick:time "+starttime);                 switch (view.getid()){                     case r.id.stop:{                         stoptime= systemclock.elapsedrealtime()-starttime;                         log.d(tag, "onclick:timefor slowstop "+stoptime);                     }                     break;                     case r.id.timeshift:{                         slstarttime=systemclock.uptimemillis()-starttime;                         log.d(tag, "onclick:timefor slowstart"+slstarttime);                     }                     break;                 }             } 

please tell me, how time without affect recording.

you have misplaced stop , timeshift button event , not called. should directly on switch case.

try this.

case r.id.video:     if (misrecordingvideo) {        stoprecordingvideo();      } else {        starttsrecordingvideo();        starttime = system.currenttimemillis();         log.d(tag, "onclick:time "+starttime);      }      break; case r.id.stop:         stoptime= systemclock.elapsedrealtime()-starttime;         log.d(tag, "onclick:timefor slowstop "+stoptime);              break; case r.id.timeshift:         slstarttime=systemclock.uptimemillis()-starttime;         log.d(tag, "onclick:timefor slowstart"+slstarttime);      break; 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -