Android Question Video Time in Camera2 and CamEx2

dieterp

Active Member
Licensed User
Longtime User
Is there built in functionality that can track how many seconds a video has been recording for when using Camera2 or CamEx2, or will I have to run a separate timer to track that? I would like the user to have the ability to click a button at various points during the recording process, which would then tag how many seconds the video has been running for each time they clicked the button
 

ilan

Expert
Licensed User
Longtime User
I would like the user to have the ability to click a button at various points during the recording process, which would then tag how many seconds the video has been running for each time they clicked the button

in this case i would not use a timer. i would use a timer only if i really need to get something from the tick event like SHOWING a timer on the screen that is updated each second or something like this. in your case you just can save the starting point on a variable (long) and then read it back when you click the button:

videoStartTime should be a global variable.

B4X:
Sub startVideo
    videoStartTime = DateTime.Now
    'start video playing here
End Sub

'then you can convert the variable to a time string
Sub button1_Click
    DateTime.TimeFormat = "HH:mm:ss"
    Log(DateTime.Time(videoStartTime))
End Sub
 
Upvote 0

dieterp

Active Member
Licensed User
Longtime User
Thanks @ilan. Your suggestion will probably be more elegant for my app as I can use this approach every time I need to get the time in video for tagging purposes.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…