video camera - get it to stay open

sheriffporter

Member
Licensed User
Longtime User
I am working on a very simple dash camera video camera app, I want to get the camera app to stay open on "standby" so I can keep the preview open and start recording when I click on record. The stock video camera app defaults to shutting off about every minute or so and loses the preview on the screen.

I was thinking of maybe setting a timer and having it re initialize the camera every 30 seconds or so, but thought I would ask if anyone has a better method? Or if anyone has a method to reset the default time to remain open on the android camera app itself.


Michael
 

sheriffporter

Member
Licensed User
Longtime User
Well, this seems to work OK anyway... Not sure if it is the best way to do it but it does keep the video camera on standby.

B4X:
 Sub Process_Globals
   Dim Timer1 As Timer
       Dim videoRecorder As VideoRecordApp
End Sub
Sub Globals
    Dim vv As VideoView
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Timer1.Initialize("Timer1", 25000) ' = 25 seconds ' default appears to be 30
   Timer1.Enabled = True

   If FirstTime Then
       videoRecorder.Initialize("videoRecorder")
    End If
       vv.Initialize("vv")
       Activity.AddView(vv, 0, 0, 100%x, 100%y)
       Activity.AddMenuItem("Record Video", "RecordVideo")
    
    End Sub
Sub Timer1_Tick
      RecordVideo_Click
End Sub
Sub RecordVideo_Click
    videoRecorder.Record(File.DirRootExternal, "movie.mp4")
End Sub
Sub videoRecorder_RecordComplete (Success As Boolean)
    Log(Success)
    If Success Then
        vv.LoadVideo(File.DirRootExternal, "movie.mp4")
        vv.Play
    End If
End Sub
Sub Activity_Resume
   Timer1_Tick
End Sub
Sub Activity_Pause (UserClosed As Boolean)
   Timer1.enabled = False
End Sub
 
Upvote 0
Top