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: 754
  • b4aAndroidVideoCapture.zip
    9.2 KB · Views: 765
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I´m getting the following error when using your example project (unchanged).
B4X:
main_b1_click (java line: 360)
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaRecorder.start()' on a null object reference
    at videowrapper.videoWrapper.setStartStopRecording(videoWrapper.java:261)
    at JHS.AndroidVideoCapture.main._b1_click(main.java:360)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
    at android.view.View.performClick(View.java:5254)
    at android.view.View$PerformClick.run(View.java:21179)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6837)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaRecorder.start()' on a null object reference

The library files are in the folder for additional libs
 

Johan Schoeman

Expert
Licensed User
Longtime User
I´m getting the following error when using your example project (unchanged).
B4X:
main_b1_click (java line: 360)
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaRecorder.start()' on a null object reference
    at videowrapper.videoWrapper.setStartStopRecording(videoWrapper.java:261)
    at JHS.AndroidVideoCapture.main._b1_click(main.java:360)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
    at android.view.View.performClick(View.java:5254)
    at android.view.View$PerformClick.run(View.java:21179)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:6837)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.media.MediaRecorder.start()' on a null object reference

The library files are in the folder for additional libs
Hi @DonManfred

Running this on my Samsung S4 mini with Android 4.4.2 and working 100%. Are you using a later Android version and might it perhaps have something to do with that?
 

Johan Schoeman

Expert
Licensed User
Longtime User
i´m using andoid.jar from v23
My device is android 5.1.1

I get shown a TOAST saying something like "failed prepare mediarecorder"
mmmm.....on my tablet with Android 4.0.4 I'm getting the same thing. Will see if I can get it sorted out. Something in the original code...
 

rboeck

Well-Known Member
Licensed User
Longtime User
Here i am using sony z1 compact, android 5.1.1 and i get identical results as DonManfred.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Here i am using sony z1 compact, android 5.1.1 and i get identical results as DonManfred.
Just a simple question - have you created the /Videos folder on your device as what I have said you should do in post #1? I completely forgot about it and therefore had the same error on my tablet. When I manually created the folder the problem was solved. So, make sure you have created the /Videos folder!
 

Mashiane

Expert
Licensed User
Longtime User
Just a simple question - have you created the /Videos folder on your device as what I have said you should do in post #1? I completely forgot about it and therefore had the same error on my tablet. When I manually created the folder the problem was solved. So, make sure you have created the /Videos folder!
Is it possible if one can perhaps specify the complete video path to save to in case I might want to save the video under File.DirInternal/<mypath> for example?
 

rboeck

Well-Known Member
Licensed User
Longtime User
Now i tried my tablet - i renamed first video to videos; but i get an new error:

B4X:
--------- beginning of main
Installing file.
PackageAdded: package:JHS.AndroidVideoCapture
Copying updated assets files (1)
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Error occurred on line: 61 (Main)
java.lang.RuntimeException: Error retrieving camcorder profile params
    at android.media.CamcorderProfile.native_get_camcorder_profile(Native Method)
    at android.media.CamcorderProfile.get(CamcorderProfile.java:384)
    at android.media.CamcorderProfile.get(CamcorderProfile.java:317)
    at videowrapper.videoWrapper.prepareMediaRecorder(videoWrapper.java:296)
    at videowrapper.videoWrapper.setStartStopRecording(videoWrapper.java:257)
    at JHS.AndroidVideoCapture.main._b1_click(main.java:387)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:668)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:334)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:244)
    at java.lang.reflect.Method.invoke(Native Method)

Its the original code, line 61 is avc1.setStartStopRecording; the device is an sony tablet z2 with android 5.1.1. The build in camera is working without problems in video mode.

Edit: It is / was a problem with videoQuality. Its now working with quality_low; i will try out which mode is working..
 

Johan Schoeman

Expert
Licensed User
Longtime User
Now i tried my tablet - i renamed first video to videos; but i get an new error:

Edit: It is / was a problem with videoQuality. Its now working with quality_low; i will try out which mode is working..

OK - glad you got it sorted out :)
 

Johan Schoeman

Expert
Licensed User
Longtime User
Posting new B4A library files (on request):

1. It will raise an event in the B4A project when the maximum specified file size was reached
2. It will raise an event in the B4A project when the recording duration specified was reached.

The first event encountered of the above two events will take preference and stop the recording - thus the second event will not occur.

Have also added:

1. specifying if a toast message should be displayed for the above mentioned events should one of them occur (different toast message for each of them)
2. specifying if the video recorder preview should be stopped when one of the above mentioned events occur.

5.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 = 5000
    avc1.MaximumFileSize = 20000000
   
    '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     
   
    avc1.StopCameraOnMaxSizeDuration = True      'added 30 Nov 2015
    avc1.ShowToastMessages = True                'added 30 Nov 2015
   
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

Library as it stands:

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:
    • 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]
    • ShowToastMessages As Boolean [write only]
    • StopCameraOnMaxSizeDuration As Boolean [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
    9.4 KB · Views: 353
  • b4aAndroidVideoCapture.zip
    9.3 KB · Views: 333

Johan Schoeman

Expert
Licensed User
Longtime User
This update adds the ability to select either the front or the back camera (for those that want to make selfies ;)). It also adds a method ZoomWithSlider that will allow a smooth zoom in / zoom out.

The attached example also use the libraries from the following two posts:
1. StartPointSeekBar - it adds the slider at the bottom of the video view. Use it for smooth zoom in / zoom out. Click on the blue link to get the library
2. Nice Spinner - a nice spinner to select the front / back camera from. Click on the blue link to get the library

PLEASE TAKE NOTE OF THE LINK TO android-support-v4.jar IN POST #1 OF NICE SPINNER. IF YOU DONT HAVE THIS VERSION OR AND EARLIER VERSION THAT SUPORTS SOME OF THE METHODS THEN THE SPINNER WILL CAUSE THIS B4A PROJECT TO CRASH!


EDIT: I HAVE ZIPPED ALL THE REQUIRED LIBRARY FILES TOGETHER IN THE POSTING EXCEPT FOR android-support-v4.jar. DOWNLOAD ALL THE LIBRARY FILES AS WELL AS andoid-support-v4.jar FROM THE LINK IN THE BLUE TEXT BELOW AND COPY ALL THE LIBRARY JAR AND XML FILES TO YOUR ADDITIONAL LIBRARY FOLDER.

HERE IS THE LINK AGAIN TO android-support-v4.jar - CLICK ON THIS WRITING


Note the files added (and properties set to read only) in the Object/res/... folder. They are only required for Nice Spinner and StartPointSeekBar. I have combined the attrs.xml files of these two libs Nice Spinner and StartPointSeekBar) into a single attrs.xml files - see the Objects/res/values folder of the attached B4A project for attrs.xml file.

If there is no front camera it should "default" to the default camera. Handle the visibility of the spinner in your code so that the user can't switch from front to back or vice versa while one of the cameras are active.

Posting the following:
1. B4A project demonstrating the Front/Back camera and the ZoomWithSlider additions
2. New B4A library files.

Please start reading at Post #1 of this thread if this is your first download else your project will not work!

6.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 As NiceSpinner
    Private spsb1 As StartPointSeekBar
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

    '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

    avc1.StopCameraOnMaxSizeDuration = True      'added 30 Nov 2015
    avc1.ShowToastMessages = True                'added 30 Nov 2015


    Dim r2 As List
    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

    spsb1.MinValue = 0
    spsb1.maxValue = 30
    spsb1.ThumbValue = 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 spsb1_value_changed

avc1.ZoomWithSlider = spsb1.CurrentThumbValue


End Sub

Library as it is 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_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
    • CameraToUse As Int [write only]
    • Color As Int [write only]
    • Enabled As Boolean
    • Height As Int
    • Left As Int
    • MaximimDuration As Int [write only]
    • MaximumFileSize As Long [write only]
    • ShowToastMessages As Boolean [write only]
    • StopCameraOnMaxSizeDuration As Boolean [write only]
    • Tag As Object
    • Top As Int
    • VideoName As String [write only]
    • VideoQuality As Int [write only]
    • Visible As Boolean
    • Width As Int
    • ZoomWithSlider As Int [write only]
 

Attachments

  • b4aAndroidVideoCaptureFrontCameraAdded.zip
    38 KB · Views: 383
  • B4ALibFilesRequired.zip
    36.2 KB · Views: 409
Last edited:

rboeck

Well-Known Member
Licensed User
Longtime User
Sorry for this problem;
I had your older versions already installed and it worked, with the version from today i get in line 39, which is loading the layout file:
B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 37 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    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.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    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:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:211)

The layout file seems ok. Any idea?
 

Johan Schoeman

Expert
Licensed User
Longtime User
Sorry for this problem;
I had your older versions already installed and it worked, with the version from today i get in line 39, which is loading the layout file:
B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 37 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    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.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    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:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:211)

The layout file seems ok. Any idea?
Did you only downloaded the Libraries and not the B4A project in post #17? See what I have said about the files in the /Objects/res/..... folders that are in the B4A project in post #17.
 

rboeck

Well-Known Member
Licensed User
Longtime User
I loaded both, i renamed the old folder and tried it an second time. My objects/res folder contains 17 files in 11 folders, they are already write protected, i didnt change anything. My version numbers in Libraries Manager are all 1.00, except Core: 4.92
I have spsb1_value_changed as last sub, so it is the todays version. The doclet version in the xml file is 1.04.
I tried it on two devices, both worked yesterday.
 
Top