B4A Library AndroidVideoCapture - video recorder that is 100% embedded in B4A (6 Jan - new Lib Files in post 48)

The attached project is based on this project (click here). I was asked by @Mashiane to wrap it so that it can be used as a 100% standalone video recorder in B4A. It uses a custom view as the video view. The following applies to the project as it stands at present:

(Read the following and take note of especially point #2 about the folder that you need to create else the app will crash)

1. It can only be used in landscape mode
2. It stores the video files in folder /sdcard/Videos/*.mp4 - there is by default no such directory in the root folder so either create it manually or else add code in the B4A project to check if it exists and if not then create it via B4A code (sure it can be found somewhere on the forum)
3. The Zoom In and Zoom out functions can probably be controlled via a slider...but for this exercise I have added two buttons (Zoom In and Zoom Out)
4. There are a vast number of options as far as specifying video quality is concerned. I have not tested them all - as a matter of fact, I have only tested 2! So, try them and see if there is a difference.
5. The flash light can be switched in two ways (and they also work in conjunction with one another):
a. touch the view while the video recording is active
b. use the "Toggle Flash" button​
6. You will need to add some code to the B4A project to refresh the media files on you device else you will not see the recorded video in the /Videos folder - unless you disconnect your device and reconnect it again (in which case it will then show). Search the forum for how to do the refresh.
7. Take note of the permissions added to the B4A manifest files (some are not required)
I will play around with the code and post updates if and when I have figured out any other useful attributes to add.

Posting the following:
1. B4A project demonstrating the use of the video recorder
2. B4A library files - copy them to your additional library folder.

B4A project launched:
1.png



Video recording started:
2.png



Zoomed In:
3.png


Flash switched on:
4.png



Sample Code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: AndroidVideoCapture
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
    'http://android-er.blogspot.co.za/2011/10/simple-exercise-of-video-capture-using.html

#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.


 
    Private b1, b2, b3, b4 As Button
    Private avc1 As AndroidVideoCapture

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
 
    avc1.MaximimDuration = 120000
    avc1.MaximumFileSize = 10000000
 
    'The video files will be stored in folder /sdcard/Videos/ of your device.
    'Add code to create this folder if the folder does not exist or else just create it manually
    avc1.VideoName = "video1"    'the video will now be stored as "video1.MP4"  
 
    avc1.VideoQuality = avc1.QUALITY_LOW    
 
 
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
 
    avc1.releaseResources

End Sub


Sub b1_Click
 
    avc1.setStartStopRecording
 
End Sub

Sub avc1_flash_toggled (flashOnOrOff As Boolean)
 
    Log("flash status = " & flashOnOrOff)
 
End Sub

Sub b2_Click
 
    avc1.toggleFlash
 
End Sub

Sub b3_Click
 
    avc1.ZoomIn
 
End Sub

Sub b4_Click
 
    avc1.ZoomOut
 
End Sub


The library as it stands at present:

AndroidVideoCapture
Author:
Original project by: Andr.oid Eric, Adapted, modified, and wrapped by: Johan Schoeman
Version: 1
  • AndroidVideoCapture
    Events:
    • flash_toggled (flashOnOrOff as Boolean As )
    Fields:
    • QUALITY_1080P As Int
    • QUALITY_2160P As Int
    • QUALITY_480P As Int
    • QUALITY_720P As Int
    • QUALITY_CIF As Int
    • QUALITY_HIGH As Int
    • QUALITY_HIGH_SPEED_1080P As Int
    • QUALITY_HIGH_SPEED_2160P As Int
    • QUALITY_HIGH_SPEED_480P As Int
    • QUALITY_HIGH_SPEED_720P As Int
    • QUALITY_HIGH_SPEED_HIGH As Int
    • QUALITY_HIGH_SPEED_LOW As Int
    • QUALITY_LOW As Int
    • QUALITY_QCIF As Int
    • QUALITY_QVGA As Int
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • ZoomIn
    • ZoomOut
    • releaseResources
    • setStartStopRecording
    • toggleFlash
    Properties:
    • Background As Drawable
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • MaximimDuration As Int [write only]
    • MaximumFileSize As Long [write only]
    • Tag As Object
    • Top As Int
    • VideoName As String [write only]
    • VideoQuality As Int [write only]
    • Visible As Boolean
    • Width As Int
 

Attachments

  • AndroidVideoCaptureLibFiles.zip
    7.6 KB · Views: 882
  • b4aAndroidVideoCapture.zip
    9.2 KB · Views: 906
Last edited:

rboeck

Well-Known Member
Licensed User
Longtime User
Its exactly your project without modification!
Maybe i dont unterstand: if i use your project, i get the files in object/res already write protected?
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Its exactly your project without modification!
Maybe i dont unterstand: if i use your project, i get the files in object/res already write protected?
Have you also downloaded android-support-v4.jar in the link of Nice Spinner? If not, the spinner will cause a crash. Please try it.
 

rboeck

Well-Known Member
Licensed User
Longtime User
You have hit the point - i readed to fast and mixed something; because there exists android-support-v13.jar also. So i had to check out, that v13 does not replace v4.
My v4 was from 2013! and now i have it from 25. 11.2015.
Thanks for your work!
 

Johan Schoeman

Expert
Licensed User
Longtime User
This is the last update that I will do for this library. Attached are new B4A library files, an updated B4A project, and the Java source code. Amend the Java code to your like should you want to add additional functionality.

This update adds the following:
1. Specifying the folder name of where you want to store the captured video (starting from the root directory of your device). See the example code. If the folder(s) that you specified does/do not exist then the library will create them.
2. Append a date/time stamp to the video name. Thus, the video name will be xxxxx_yyyyMMdd_HHmmss.MP4 (to prevent overwriting video files with the same name)
3. Customise the toast message to be displayed for the Max Duration and Max Files Size reached events - see the example code
4. Return a list of the supported video preview sizes for the selected camera of your device.

1.png


Sample Code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: AndroidVideoCapture
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
    'http://android-er.blogspot.co.za/2011/10/simple-exercise-of-video-capture-using.html

#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.


   
    Private b1, b2, b3, b4 As Button
   
    Private avc1 As AndroidVideoCapture

    Private ns1, ns2 As NiceSpinner
    Private spsb1 As StartPointSeekBar
    Private r2, r3 As List

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
   
    avc1.MaximimDuration = 20000
    avc1.MaximumFileSize = 20000000
   
    avc1.MaximumDurationReachedToastMessage = "Maximum duration reached"       'added 4 Dec 2015 - set your own toast message when Max Dur is reached during recording
    avc1.MaximumFileSizeReachedToastMessage = "Maximum file size reached"      'added 4 Dec 2015 - set your own toast message when Max Files Size is reached during recording
   
    'The video files will be stored in folder /sdcard/Videos/ of your device.
    'Add code to create this folder if the folder does not exist or else just create it manually   
    avc1.VideoName = "video1"                           'amended 4 Dec 2015 - the captured video will now be stored as "video1_yyyyMMdd_HHmmss.MP4"     
                                                        'i.e a date/time stamp will de added/appended to the video name
   
    avc1.StopCameraOnMaxSizeDuration = True             'added 30 Nov 2015
    avc1.ShowToastMessages = True                       'added 30 Nov 2015
   
'    avc1.VideoFolderName = "MyVideoFolder"              'added 4 Dec 2015 (it will make a folder called MyVideoFolder in the root directory of your device and store the videos in that folder
    avc1.VideoFolderName = "MyVideoFolder/Videos"       'added 4 Dec 2015 (it will make a tree of folder called MyVideoFolder/Videos in the root directory of your device and store the videos in the Videos sub folder
   


    r2.Initialize    
    r2.AddAll(Array As String("BACK", "FRONT"))          
    Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
    ns1.DividerColor = divcolor
    ns1.DividerHeight = 3
    ns1.DropdownListBackgroundColor = Colors.Black
    ns1.attachDataSource(r2)
    ns1.DropdownListTextColor = Colors.White
    'the next two lines of code must be before ns2.SelectedIndex is set
    ns1.SelectedTextColor = Colors.White
    ns1.SelectedTextBackgroundColor = Colors.Gray
    'always set this even if just to 0

    ns1.SelectedIndex = 0                                                 '0 = BACK CAMERA, 1 = FRONT CAMERA
   
    spsb1.MinValue = 0
    spsb1.maxValue = 30
    spsb1.ThumbValue = 0
   

    r3.Initialize    
    Dim qualitylist() As String                                           'added 4 Dec - get a list of the device's supported video preview sizes / quality
    qualitylist = avc1.QualitySupportedList
    For i = 0 To qualitylist.Length - 1
        If qualitylist(i) <> "" Then
          r3.Add(qualitylist(i))
        End If
        Log(qualitylist(i))
        Log("")
    Next
       
    Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
    ns2.DividerColor = divcolor
    ns2.DividerHeight = 3
    ns2.DropdownListBackgroundColor = Colors.Black
    ns2.attachDataSource(r3)
    ns2.DropdownListTextColor = Colors.White
    'the next two lines of code must be before ns2.SelectedIndex is set
    ns2.SelectedTextColor = Colors.White
    ns2.SelectedTextBackgroundColor = Colors.Gray
    'always set this even if just to 0   
    ns2.SelectedIndex = 0
   
   

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
    avc1.releaseResources

End Sub


Sub b1_Click
   
    avc1.setStartStopRecording
   
End Sub

Sub avc1_flash_toggled (flashOnOrOff As Boolean)
   
    Log("flash status = " & flashOnOrOff)
   
End Sub

Sub avc1_max_file_size_reached (maxsizereached As Boolean)            'added 30 Nov 2015
   
    Log("maximum file size reached = " & maxsizereached)
   
End Sub

Sub avc1_max_duration_reached (maxdurationreached As Boolean)         'added 30 Nov 2015
   
    Log("maximum duration reached = " & maxdurationreached)
   
End Sub


Sub b2_Click
   
    avc1.toggleFlash
   
End Sub

Sub b3_Click
   
    avc1.ZoomIn
   
End Sub

Sub b4_Click
   
    avc1.ZoomOut
   
End Sub

Sub ns1_item_clicked

    If ns1.SelectedIndex = 0 Then
      Log(ns1.SelectedIndex)
      avc1.CameraToUse = avc1.CAMERA_BACK         'added 1 Dec 2015 - Option to select the FRONT / BACK camera
    Else
      avc1.CameraToUse = avc1.CAMERA_FRONT
    End If  

End Sub


Sub ns2_item_clicked

    Dim a As Int
    a = ns2.SelectedIndex
   
    If r3.Get(a) = "QUALITY_1080P" Then
        avc1.VideoQuality = avc1.QUALITY_1080P                                 'although QUALITY_1080P records there seems to be problem with the playback of the video....? Not playing it back well at all
    End If
   
    If r3.Get(a) = "QUALITY_720P" Then
        avc1.VideoQuality = avc1.QUALITY_720P                               
    End If   
   
    If r3.Get(a) = "QUALITY_480P" Then
        avc1.VideoQuality = avc1.QUALITY_480P                               
    End If       
   
    If r3.Get(a) = "QUALITY_QVGA" Then
        avc1.VideoQuality = avc1.QUALITY_QVGA                               
    End If       
   
    If r3.Get(a) = "QUALITY_QCIF" Then
        avc1.VideoQuality = avc1.QUALITY_QCIF                               
    End If   
   
    If r3.Get(a) = "QUALITY_LOW" Then
        avc1.VideoQuality = avc1.QUALITY_LOW                               
    End If   
   
    If r3.Get(a) = "QUALITY_HIGH" Then
        avc1.VideoQuality = avc1.QUALITY_HIGH                               
    End If           
   
               


End Sub

Sub spsb1_value_changed

avc1.ZoomWithSlider = spsb1.CurrentThumbValue


End Sub


The Library as it stands at present:

AndroidVideoCapture
Author:
Original project by: Andr.oid Eric, Adapted, modified, and wrapped by: Johan Schoeman
Version: 1
  • AndroidVideoCapture
    Events:
    • flash_toggled (flashOnOrOff As Boolean)
    • max_duration_reached (maxdurationreached As Boolean)
    • max_file_size_reached (maxsizereached As Boolean)
    Fields:
    • CAMERA_BACK As Int
    • CAMERA_FRONT As Int
    • QUALITY_1080P As Int
    • QUALITY_2160P As Int
    • QUALITY_480P As Int
    • QUALITY_720P As Int
    • QUALITY_CIF As Int
    • QUALITY_HIGH As Int
    • QUALITY_LOW As Int
    • QUALITY_QCIF As Int
    • QUALITY_QVGA As Int
    • ba As BA
    Methods:
    • BringToFront
    • DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
    • Initialize (EventName As String)
    • Invalidate
    • Invalidate2 (arg0 As Rect)
    • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • IsInitialized As Boolean
    • RemoveView
    • RequestFocus As Boolean
    • SendToBack
    • SetBackgroundImage (arg0 As Bitmap)
    • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
    • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
    • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
    • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
    • ZoomIn
    • ZoomOut
    • releaseResources
    • setStartStopRecording
    • toggleFlash
    Properties:
    • Background As Drawable
    • CameraToUse As Int [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • MaximimDuration As Int [write only]
    • MaximumDurationReachedToastMessage As String [write only]
    • MaximumFileSize As Long [write only]
    • MaximumFileSizeReachedToastMessage As String [write only]
    • QualitySupportedList() As String [read only]
    • ShowToastMessages As Boolean [write only]
    • StopCameraOnMaxSizeDuration As Boolean [write only]
    • Tag As Object
    • Top As Int
    • VideoFolderName As String [write only]
    • VideoName As String [write only]
    • VideoQuality As Int [write only]
    • Visible As Boolean
    • Width As Int
    • ZoomWithSlider As Int [write only]
 

Attachments

  • AndroidVideoCaptureLibFilesNew.zip
    10.7 KB · Views: 355
  • b4aAndroidVideoCaptureNew.zip
    38.7 KB · Views: 346
  • TheJavaCode.zip
    27.4 KB · Views: 317

Johan Schoeman

Expert
Licensed User
Longtime User
An update as advised by @Mahares :

1. Bug fix for devices that do not support FOCUS_MODE_CONTINUOUS_VIDEO
2. Bug fix for devices that do not support a Flash/Torch
3. Added an event in B4A that returns the remaining recording time relative to the preset recording time - see the attached sample B4A project for the new event added.
4. Add / don't add a timestamp to the name of the recorded video file.

Posting:
1. Updated B4A project
2. Updated B4A library files
3. Updated Java code

1.png



Sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: AndroidVideoCapture
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
    'http://android-er.blogspot.co.za/2011/10/simple-exercise-of-video-capture-using.html

#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private b1, b2, b3, b4 As Button
    Private avc1 As AndroidVideoCapture
    Private ns1, ns2 As NiceSpinner
    Private spsb1 As StartPointSeekBar
    Private r2, r3 As List
    Private l1 As Label
   
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
   
    avc1.MaximimDuration = 60000 * 60
    avc1.MaximumFileSize = 1000000000
   
    avc1.MaximumDurationReachedToastMessage = "Maximum duration reached"       'added 4 Dec 2015 - set your own toast message when Max Dur is reached during recording
    avc1.MaximumFileSizeReachedToastMessage = "Maximum file size reached"      'added 4 Dec 2015 - set your own toast message when Max Files Size is reached during recording
   
    'The video files will be stored in folder /sdcard/Videos/ of your device.
    'Add code to create this folder if the folder does not exist or else just create it manually   
    avc1.VideoName = "video1"                           'amended 4 Dec 2015 - the captured video will now be stored as "video1_yyyyMMdd_HHmmss.MP4"     
                                                        'i.e a date/time stamp will de added/appended to the video name
   
    avc1.StopCameraOnMaxSizeDuration = True             'added 30 Nov 2015
    avc1.ShowToastMessages = True                       'added 30 Nov 2015
   
'    avc1.VideoFolderName = "MyVideoFolder"              'added 4 Dec 2015 (it will make a folder called MyVideoFolder in the root directory of your device and store the videos in that folder
    avc1.VideoFolderName = "MyVideoFolder/Videos"       'added 4 Dec 2015 (it will make a tree of folder called MyVideoFolder/Videos in the root directory of your device and store the videos in the Videos sub folder
   
    avc1.AddTimeStampToFileName = True                  'added 6 Dec 2015 - option to add timestamp to the name of the video file
   
    r2.Initialize    
    r2.AddAll(Array As String("BACK", "FRONT"))          
    Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
    ns1.DividerColor = divcolor
    ns1.DividerHeight = 3
    ns1.DropdownListBackgroundColor = Colors.Black
    ns1.attachDataSource(r2)
    ns1.DropdownListTextColor = Colors.White
    'the next two lines of code must be before ns2.SelectedIndex is set
    ns1.SelectedTextColor = Colors.White
    ns1.SelectedTextBackgroundColor = Colors.Gray
    'always set this even if just to 0

    ns1.SelectedIndex = 0                                                 '0 = BACK CAMERA, 1 = FRONT CAMERA
   
    spsb1.MinValue = 0
    spsb1.maxValue = 30
    spsb1.ThumbValue = 0
   

    r3.Initialize    
    Dim qualitylist() As String                                           'added 4 Dec - get a list of the device's supported video preview sizes / quality
    qualitylist = avc1.QualitySupportedList
    For i = 0 To qualitylist.Length - 1
        If qualitylist(i) <> "" Then
          r3.Add(qualitylist(i))
        End If
        Log(qualitylist(i))
        Log("")
    Next
       
    Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
    ns2.DividerColor = divcolor
    ns2.DividerHeight = 3
    ns2.DropdownListBackgroundColor = Colors.Black
    ns2.attachDataSource(r3)
    ns2.DropdownListTextColor = Colors.White
    'the next two lines of code must be before ns2.SelectedIndex is set
    ns2.SelectedTextColor = Colors.White
    ns2.SelectedTextBackgroundColor = Colors.Gray
    'always set this even if just to 0   
    ns2.SelectedIndex = 0
   
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
   
    avc1.releaseResources
    avc1.stopTimer

End Sub

Sub b1_Click
   
    avc1.setStartStopRecording
   
End Sub

Sub avc1_flash_toggled (flashOnOrOff As Boolean)
   
    Log("flash status = " & flashOnOrOff)
   
End Sub

Sub avc1_max_file_size_reached (maxsizereached As Boolean)            'added 30 Nov 2015
   
    Log("maximum file size reached = " & maxsizereached)
   
End Sub

Sub avc1_max_duration_reached (maxdurationreached As Boolean)         'added 30 Nov 2015
   
    Log("maximum duration reached = " & maxdurationreached)
   
End Sub

Sub avc1_recording_time_remaining (timeLeft As String)                'added 6 Dec 2015 - display the recording remaining time
   
    If timeLeft.Length = 3 Then
        timeLeft = "0" & timeLeft.SubString2(0,2) & "0" & timeLeft.SubString2(2,3)
    End If
   
    If ((timeLeft.Length = 4) And (timeLeft.IndexOf(":") = 2)) Then
        timeLeft = timeLeft.SubString2(0,3) & "0" & timeLeft.SubString2(3,4)
    End If
   
    If ((timeLeft.Length = 4) And (timeLeft.IndexOf(":") = 1)) Then
        timeLeft = "0" & timeLeft
    End If   
   
    l1.Text = "Recording Time Remaining = " & timeLeft
   
End Sub


Sub b2_Click
   
    avc1.toggleFlash
   
End Sub

Sub b3_Click
   
    avc1.ZoomIn
   
End Sub

Sub b4_Click
   
    avc1.ZoomOut
   
End Sub

Sub ns1_item_clicked

    If ns1.SelectedIndex = 0 Then
      Log(ns1.SelectedIndex)
      avc1.CameraToUse = avc1.CAMERA_BACK         'added 1 Dec 2015 - Option to select the FRONT / BACK camera
    Else
      avc1.CameraToUse = avc1.CAMERA_FRONT
    End If  

End Sub

Sub ns2_item_clicked

    Dim a As Int
    a = ns2.SelectedIndex
   
    If r3.Get(a) = "QUALITY_1080P" Then
        avc1.VideoQuality = avc1.QUALITY_1080P                                 'although QUALITY_1080P records there seems to be problem with the playback of the video....? Not playing it back well at all
    End If
   
    If r3.Get(a) = "QUALITY_720P" Then
        avc1.VideoQuality = avc1.QUALITY_720P                               
    End If   
   
    If r3.Get(a) = "QUALITY_480P" Then
        avc1.VideoQuality = avc1.QUALITY_480P                               
    End If       
   
    If r3.Get(a) = "QUALITY_QVGA" Then
        avc1.VideoQuality = avc1.QUALITY_QVGA                               
    End If       
   
    If r3.Get(a) = "QUALITY_QCIF" Then
        avc1.VideoQuality = avc1.QUALITY_QCIF                               
    End If   
   
    If r3.Get(a) = "QUALITY_LOW" Then
        avc1.VideoQuality = avc1.QUALITY_LOW                               
    End If   
   
    If r3.Get(a) = "QUALITY_HIGH" Then
        avc1.VideoQuality = avc1.QUALITY_HIGH                               
    End If           
   
End Sub

Sub spsb1_value_changed

avc1.ZoomWithSlider = spsb1.CurrentThumbValue

End Sub
 

Attachments

  • TheJavaCode.zip
    6.7 KB · Views: 302
  • b4aAndroidVideoCaptureNew.zip
    39 KB · Views: 319
  • AndroidVideoCaptureLibFiles.zip
    12.2 KB · Views: 350

Johan Schoeman

Expert
Licensed User
Longtime User
Brilliant!! thanks again Johan. Just one question, if one changes the video mode to 3GPP instead of MP4, wouldnt that have a smaller file size?
Will look into that...
 

SJQ

Member
Licensed User
Longtime User
Hi Johan.

Great Library.:)

I have a couple of issues though:

On a particular device type I am getting NullPointerException error on AVC1.setStartStopRecording however this device only has a front camera it does not have a back camera. (if I choose a camera that does not exist I get a different error and the folders are set correctly).

This process works fine on the other devices that have both cameras.

I have a maximum record time set at 60 seconds and if I allow this time to expire and end automatically the recorded video will not always play back, appears to be corrupted?
if I stop recording 1 second before the time runs out, by calling AVC1.setStartStopRecording the video always saves correctly and can be playback.

Also again with the maximum record time set, once I have called AVC1.setStartStopRecording and recording has completed and I am finished with video, a while later I still get a toast message reporting maximum file size reached?
if I turn off messages this does not appear but I still get a notification sound. if I try to record again before the notification the application errors,
if I set StopCameraOnMaxSizeDuration = False then I don't get the error.


Regards
Steve
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan.

Great Library.:)

I have a couple of issues though:

On a particular device type I am getting NullPointerException error on AVC1.setStartStopRecording however this device only has a front camera it does not have a back camera. (if I choose a camera that does not exist I get a different error and the folders are set correctly).

This process works fine on the other devices that have both cameras.

I have a maximum record time set at 60 seconds and if I allow this time to expire and end automatically the recorded video will not always play back, appears to be corrupted?
if I stop recording 1 second before the time runs out, by calling AVC1.setStartStopRecording the video always saves correctly and can be playback.

Also again with the maximum record time set, once I have called AVC1.setStartStopRecording and recording has completed and I am finished with video, a while later I still get a toast message reporting maximum file size reached?
if I turn off messages this does not appear but I still get a notification sound. if I try to record again before the notification the application errors,
if I set StopCameraOnMaxSizeDuration = False then I don't get the error.


Regards
Steve
Just to be sure, are you using the library and project in post #26 above?
 

SJQ

Member
Licensed User
Longtime User
Hi Johan,

Yep I am using the library files from post #26
The device is the Acer DA241HL and a slightly new model plus the Viewsonic (VSD224) but same spec both have only one camera and its on the front.
Your library works great on the other tablets I have; Hudi, Samsung T3, Kurio 10" and a rugged 7" (Chinese import)

I have worked around the issue with the record timer and max file size reached etc, just the null pointer exception.

Regards
Steve
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan,

Yep I am using the library files from post #26
The device is the Acer DA241HL and a slightly new model plus the Viewsonic (VSD224) but same spec both have only one camera and its on the front.
Your library works great on the other tablets I have; Hudi, Samsung T3, Kurio 10" and a rugged 7" (Chinese import)

I have worked around the issue with the record timer and max file size reached etc, just the null pointer exception.

Regards
Steve
Ok Steve - will add some debugging lines in the wrapper so that we can trap the error and fix it. Does your devices with the front camera only start the video recording at all i.e the error appears but the app runs?
 

SJQ

Member
Licensed User
Longtime User
Hi Johan,

The app runs OK. there is no preview of the camera output, the error only occurs when you toggle AVC1.setStartStopRecording.

On my other devices, again there's no preview. But the output of the camera displays correctly when you toggle AVC1.setStartStopRecording.

Thanks
Steve
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan,

The app runs OK. there is no preview of the camera output, the error only occurs when you toggle AVC1.setStartStopRecording.

On my other devices, again there's no preview. But the output of the camera displays correctly when you toggle AVC1.setStartStopRecording.

Thanks
Steve
Steve, please try the attached library files. The B4A project is unchanged as what I have posted in post #26 above. Only the library changed.
 

Attachments

  • AndroidVideoCapture.zip
    12.8 KB · Views: 288

SJQ

Member
Licensed User
Longtime User
Hi Johan,

I am back in the office tomorrow (I left my Acer All In One there and forgot it) I will try it out and let you know.

Many Thanks
Steve
 

Johan Schoeman

Expert
Licensed User
Longtime User
Here is an update based on the feedback received from Steve (@SJQ). Posting an updated B4A project and all the library files that you will require. Take note of all the files in the project's /Objects/res/bla..bla..bla folders in case you start a project from scratch. Have done the following changes:

1. It should now (hopefully) support devices with
a. front camera only
b. back camera only (I could not test this so it will be good to have some feedback on this)
c. font and back camera​
2. It will extract the supported quality parameters for each of the available camera(s) and the spinner on the right (SUPPORTED QUALITY) will be populated according to your selection of the spinner on the left (FRONT / BACK).
3. The spinner on the left (FRONT/BACK) will be populated based on the cameras that your device supports.
4. It tests for the presence of any sort of camera(s) on a device (front, back, front & back)
5. It tests for the presence of a flash

It would be great to have some feedback from you especially from those of you that might have devices with a back facing camera only (with and without a flash) and devices with a front facing camera only (with and without flash). I have tested it on 3 x devices:
1. Front and Back camera with flash at the back
2. Front and back camera with no flash
3. Front camera only with no flash

Please note:
1. it does not support the new camera API
2. There are still lots of Log messages being printed to the B4A log from the library for debugging purposes.

1.png



Sample code:

B4X:
#Region  Project Attributes
    #ApplicationLabel: AndroidVideoCapture
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: landscape
    #CanInstallToExternalStorage: False
    'http://android-er.blogspot.co.za/2011/10/simple-exercise-of-video-capture-using.html

#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

    Private b1, b2, b3, b4 As Button
    Private avc1 As AndroidVideoCapture
    Private ns1, ns2 As NiceSpinner
    Private spsb1 As StartPointSeekBar
    Private r2, r3, r4 As List
    Private l1 As Label
 
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
 
    r2.Initialize
    r3.Initialize
    r4.Initialize 
 
    avc1.MaximimDuration = 15000
    avc1.MaximumFileSize = 1000000000
 
    avc1.MaximumDurationReachedToastMessage = "Maximum duration reached"       'added 4 Dec 2015 - set your own toast message when Max Dur is reached during recording
    avc1.MaximumFileSizeReachedToastMessage = "Maximum file size reached"      'added 4 Dec 2015 - set your own toast message when Max Files Size is reached during recording
 
    'The video files will be stored in folder /sdcard/Videos/ of your device.
    'Add code to create this folder if the folder does not exist or else just create it manually 
    avc1.VideoName = "video1"                           'amended 4 Dec 2015 - the captured video will now be stored as "video1_yyyyMMdd_HHmmss.MP4"   
                                                        'i.e a date/time stamp will de added/appended to the video name
 
    avc1.StopCameraOnMaxSizeDuration = True             'added 30 Nov 2015
    avc1.ShowToastMessages = True                       'added 30 Nov 2015
 
'    avc1.VideoFolderName = "MyVideoFolder"              'added 4 Dec 2015 (it will make a folder called MyVideoFolder in the root directory of your device and store the videos in that folder
    avc1.VideoFolderName = "MyVideoFolder/Videos"       'added 4 Dec 2015 (it will make a tree of folder called MyVideoFolder/Videos in the root directory of your device and store the videos in the Videos sub folder
 
    avc1.AddTimeStampToFileName = True                  'added 6 Dec 2015 - option to add timestamp to the name of the video file
 


    'Check what cameras the device has
    'Both back and front camera ID's are initially set to -1 in the library
    'If there is a back and front camera then the retuned ID's will be BACK = 0 and FRONT = 1
    'If there is only a back facing camera then the returned ID's will be BACK = 0 and FRONT = -1
    'If there is only a front facing camera then the returned ID's will be BACK = -1 and FRONT = 0
    If avc1.BackFacingCamera = 0 And avc1.FrontFacingCamera = 1 Then
        r2.AddAll(Array As String("BACK", "FRONT"))
        r3 = avc1.getBackSupportedVideoQuality(0) 
        r4 = avc1.getFrontSupportedVideoQuality(1)     
        ns2.attachDataSource(r3) 
    else if avc1.BackFacingCamera = 0 And avc1.FrontFacingCamera = -1 Then
        r2.AddAll(Array As String("BACK"))
        r3 = avc1.getBackSupportedVideoQuality(0) 
        ns2.attachDataSource(r3)     
    else if avc1.BackFacingCamera = -1 And avc1.FrontFacingCamera = 0 Then     
        r2.AddAll(Array As String("FRONT"))
        r4 = avc1.getFrontSupportedVideoQuality(0) 
        ns2.attachDataSource(r4)
    End If
 
 
    Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
    ns1.DividerColor = divcolor
    ns1.DividerHeight = 3
    ns1.DropdownListBackgroundColor = Colors.Black
    ns1.attachDataSource(r2)
    ns1.DropdownListTextColor = Colors.White
    'the next two lines of code must be before ns2.SelectedIndex is set
    ns1.SelectedTextColor = Colors.White
    ns1.SelectedTextBackgroundColor = Colors.Gray
    'always set this even if just to 0
    ns1.SelectedIndex = 0 
 
    Dim divcolor() As Int = Array As Int(Colors.White, Colors.White, Colors.White)
    ns2.DividerColor = divcolor
    ns2.DividerHeight = 3
    ns2.DropdownListBackgroundColor = Colors.Black
    ns2.DropdownListTextColor = Colors.White
    'the next two lines of code must be before ns2.SelectedIndex is set
    ns2.SelectedTextColor = Colors.White
    ns2.SelectedTextBackgroundColor = Colors.Gray
    'always set this even if just to 0                                                     '0 = BACK CAMERA, 1 = FRONT CAMERA
    ns2.SelectedIndex = 0
 
    spsb1.MinValue = 0
    spsb1.maxValue = 30
    spsb1.ThumbValue = 0
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)
 
    avc1.releaseResources
    avc1.stopTimer

End Sub

Sub b1_Click
 
    Log("SELECTED INDEX = " & ns2.SelectedIndex)
    Log(r3.Get(ns2.SelectedIndex))
    Log(r4.Get(ns2.SelectedIndex)) 
    avc1.setStartStopRecording
 
End Sub

Sub avc1_flash_toggled (flashOnOrOff As Boolean)
 
    Log("flash status = " & flashOnOrOff)
 
End Sub

Sub avc1_max_file_size_reached (maxsizereached As Boolean)            'added 30 Nov 2015
 
    Log("maximum file size reached = " & maxsizereached)
 
End Sub

Sub avc1_max_duration_reached (maxdurationreached As Boolean)         'added 30 Nov 2015
 
    Log("maximum duration reached = " & maxdurationreached)
 
End Sub

Sub avc1_recording_time_remaining (timeLeft As String)                'added 6 Dec 2015 - display the recording remaining time
 
    If timeLeft.Length = 3 Then
        timeLeft = "0" & timeLeft.SubString2(0,2) & "0" & timeLeft.SubString2(2,3)
    End If
 
    If ((timeLeft.Length = 4) And (timeLeft.IndexOf(":") = 2)) Then
        timeLeft = timeLeft.SubString2(0,3) & "0" & timeLeft.SubString2(3,4)
    End If
 
    If ((timeLeft.Length = 4) And (timeLeft.IndexOf(":") = 1)) Then
        timeLeft = "0" & timeLeft
    End If 
 
    l1.Text = "Recording Time Remaining = " & timeLeft
 
End Sub


Sub b2_Click
 
    avc1.toggleFlash
 
End Sub

Sub b3_Click
 
    avc1.ZoomIn
 
End Sub

Sub b4_Click
 
    avc1.ZoomOut
 
End Sub

Sub ns1_item_clicked

    If ns1.SelectedIndex = 0 Then
      Log(ns1.SelectedIndex)
      avc1.CameraToUse = avc1.CAMERA_BACK         'added 1 Dec 2015 - Option to select the FRONT / BACK camera
      ns2.attachDataSource(r3)
      ns2.DropdownListBackgroundColor = Colors.Black
      ns2.DropdownListTextColor = Colors.White   
      ns2.SelectedIndex = 0
    Else
      avc1.CameraToUse = avc1.CAMERA_FRONT
      ns2.attachDataSource(r4)
      ns2.DropdownListBackgroundColor = Colors.Black
      ns2.DropdownListTextColor = Colors.White   
      ns2.SelectedIndex = 0
    End If

End Sub

Sub ns2_item_clicked

    Dim a As Int
    a = ns2.SelectedIndex
 
    If r2.Get(ns1.SelectedIndex) = "BACK" Then     
        If r3.Get(a) = "QUALITY_2160P" Then
            avc1.VideoQuality = avc1.QUALITY_2160P                              
        End If 
     
        If r3.Get(a) = "QUALITY_1080P" Then
            avc1.VideoQuality = avc1.QUALITY_1080P                              
        End If
     
        If r3.Get(a) = "QUALITY_720P" Then
            avc1.VideoQuality = avc1.QUALITY_720P                             
        End If 
     
        If r3.Get(a) = "QUALITY_480P" Then
            avc1.VideoQuality = avc1.QUALITY_480P                             
        End If     
     
        If r3.Get(a) = "QUALITY_QVGA" Then
            avc1.VideoQuality = avc1.QUALITY_QVGA                             
        End If     
     
        If r3.Get(a) = "QUALITY_QCIF" Then
            avc1.VideoQuality = avc1.QUALITY_QCIF                             
        End If 
     
        If r3.Get(a) = "QUALITY_CIF" Then
            avc1.VideoQuality = avc1.QUALITY_CIF                             
        End If 
     
        If r3.Get(a) = "QUALITY_LOW" Then
            avc1.VideoQuality = avc1.QUALITY_LOW                             
        End If 
     
        If r3.Get(a) = "QUALITY_HIGH" Then
            avc1.VideoQuality = avc1.QUALITY_HIGH                             
        End If 
    End If         
 
    If r2.Get(ns1.SelectedIndex) = "FRONT" Then     
        If r4.Get(a) = "QUALITY_2160P" Then
            avc1.VideoQuality = avc1.QUALITY_2160P                              
        End If 
     
        If r4.Get(a) = "QUALITY_1080P" Then
            avc1.VideoQuality = avc1.QUALITY_1080P                              
        End If
     
        If r4.Get(a) = "QUALITY_720P" Then
            avc1.VideoQuality = avc1.QUALITY_720P                             
        End If 
     
        If r4.Get(a) = "QUALITY_480P" Then
            avc1.VideoQuality = avc1.QUALITY_480P                             
        End If     
     
        If r4.Get(a) = "QUALITY_QVGA" Then
            avc1.VideoQuality = avc1.QUALITY_QVGA                             
        End If     
     
        If r4.Get(a) = "QUALITY_QCIF" Then
            avc1.VideoQuality = avc1.QUALITY_QCIF                             
        End If 
     
        If r4.Get(a) = "QUALITY_CIF" Then
            avc1.VideoQuality = avc1.QUALITY_CIF                             
        End If 
     
        If r4.Get(a) = "QUALITY_LOW" Then
            avc1.VideoQuality = avc1.QUALITY_LOW                             
        End If 
     
        If r4.Get(a) = "QUALITY_HIGH" Then
            avc1.VideoQuality = avc1.QUALITY_HIGH                             
        End If 
    End If             
 
End Sub

Sub spsb1_value_changed

avc1.ZoomWithSlider = spsb1.CurrentThumbValue

End Sub
 

Attachments

  • AllLibraryFiles.zip
    40.8 KB · Views: 293
  • b4aAndroidVideoCapture.zip
    39.3 KB · Views: 288
Last edited:

SJQ

Member
Licensed User
Longtime User
Hi Johan,

Well that was interesting. for some reason the camera is not there...

I have run up the Camera sample that uses the Camera Library (V2.20) and that's working ok on the same device.
Front Camera Only, No Back camera and no flash.

When I use the camera library (V2.20) and if I try to specify rear camera the screen flashes for a second, no log messages, and just returns to the front camera.

So, what could be the cause of that? Is this something to do with the new Camera API?

Regards
Steve


here is the log output:

Installing file.
** Activity (main) Pause, UserClosed = false **
WakeLock already held.
PackageAdded: package:JHS.AndroidVideoCapture
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
dont have a camera
Error occurred on line: 38 (Main)
java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at JHS.AndroidVideoCapture.main.afterFirstLayout(main.java:102)
at JHS.AndroidVideoCapture.main.access$000(main.java:17)
at JHS.AndroidVideoCapture.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.view.ViewGroup.addViewInner(ViewGroup.java:3338)
at android.view.ViewGroup.addView(ViewGroup.java:3210)
at android.view.ViewGroup.addView(ViewGroup.java:3186)
at videowrapper.videoWrapper.AddToParent(videoWrapper.java:211)
at videowrapper.videoWrapper.DesignerCreateView(videoWrapper.java:219)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:60)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 21 more
** Activity (main) Resume **
WakeLock already held.
Connected to B4A-Bridge (Wifi)
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan,

Well that was interesting. for some reason the camera is not there...

I have run up the Camera sample that uses the Camera Library (V2.20) and that's working ok on the same device.
Front Camera Only, No Back camera and no flash.

When I use the camera library (V2.20) and if I try to specify rear camera the screen flashes for a second, no log messages, and just returns to the front camera.

So, what could be the cause of that? Is this something to do with the new Camera API?

Regards
Steve


here is the log output:

Installing file.
** Activity (main) Pause, UserClosed = false **
WakeLock already held.
PackageAdded: package:JHS.AndroidVideoCapture
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
dont have a camera
Error occurred on line: 38 (Main)
java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at JHS.AndroidVideoCapture.main.afterFirstLayout(main.java:102)
at JHS.AndroidVideoCapture.main.access$000(main.java:17)
at JHS.AndroidVideoCapture.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.view.ViewGroup.addViewInner(ViewGroup.java:3338)
at android.view.ViewGroup.addView(ViewGroup.java:3210)
at android.view.ViewGroup.addView(ViewGroup.java:3186)
at videowrapper.videoWrapper.AddToParent(videoWrapper.java:211)
at videowrapper.videoWrapper.DesignerCreateView(videoWrapper.java:219)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:60)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 21 more
** Activity (main) Resume **
WakeLock already held.
Connected to B4A-Bridge (Wifi)
What version of the OS is running on your device Steve? This is mind boggling...why would it say there is no camera? I see the message in the log. It is one of the debugging messages that I have added. Runs fine on my device with a front camera only (KitKat). Very puzzling.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan,

Well that was interesting. for some reason the camera is not there...

I have run up the Camera sample that uses the Camera Library (V2.20) and that's working ok on the same device.
Front Camera Only, No Back camera and no flash.

When I use the camera library (V2.20) and if I try to specify rear camera the screen flashes for a second, no log messages, and just returns to the front camera.

So, what could be the cause of that? Is this something to do with the new Camera API?

Regards
Steve

Hi Steve

If you can, please try with the attached library files. Have changed a call in the library from hasSystemFeature(PackageManager.FEATURE_CAMERA) to hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)

Also comment the two lines as what I have done in the following code (lines 129 and 130):

B4X:
Sub b1_Click
   
    Log("SELECTED INDEX = " & ns2.SelectedIndex)
'    Log(r3.Get(ns2.SelectedIndex))
'    Log(r4.Get(ns2.SelectedIndex))   
    avc1.setStartStopRecording
   
End Sub

 

Attachments

  • AndroidVideoCapture (2).zip
    14.2 KB · Views: 271
Last edited:
Top