B4A Library HBRecorder (Screen recorder)

Discussion in 'Additional libraries, classes and official updates' started by somed3v3loper, Oct 10, 2019.

  1. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    This project in B4A (not complete )

    Code:
    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
        Dim hbRecorder As hbrecorder
    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("Layout1")
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
        
    Wait For Activity_PermissionResult(perm As String,res As Boolean)
        
    If perm=Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE And res=True Then
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
        
    Wait For Activity_PermissionResult(perm As String,res As Boolean)
            
    If perm=Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE And res=True Then
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_RECORD_AUDIO)
            
    Wait For Activity_PermissionResult(perm As String,res As Boolean)
            
    If perm=Starter.rp.PERMISSION_RECORD_AUDIO And res=True Then
                hbRecorder.Initialize(
    "rec")
                hbRecorder.enableCustomSettings

                    hbRecorder.OutputPath= Starter.rp.GetSafeDirDefaultExternal(
    "HBRecorder")
                hbRecorder.AudioBitrate=
    128000
                hbRecorder.AudioSamplingRate=
    44100
                
    If hbRecorder.isBusyRecording Then
                    
    Log("busy")
                
    Else
                    
    Log("Not busy")
                
    End If
            
    End If
        
    End If
       
        
    End If
        hbRecorder.shouldShowNotification(
    True)
        hbRecorder.NotificationTitle=
    "Title"
        hbRecorder.NotificationSmallIcon=
    "icon"
        hbRecorder.NotificationDescription=
    "Description"
       
        hbRecorder.startRecordingScreen      
    End Sub
    Sub rec_resultarrived(arg As Int,data As Intent)
        
    If data.IsInitialized Then
            
    Log("rec_resultarrived")
           
            hbRecorder.recordHDVideo(
    False)
            hbRecorder.isAudioEnabled(
    False)
            hbRecorder.startScreenRecording(arg ,data)
        
    End If

    End Sub
    Sub rec_hbrecorderonerror(errcode As Int)
        
    Log("rec_hbrecorderonerror: "&errcode)
    End Sub
    Sub rec_hbrecorderoncomplete
        
    Log("rec_HBRecorderOnComplete")
    End Sub

    Sub Activity_click
        
    Log("Clicked"&hbRecorder.isBusyRecording)
        hbRecorder.stopScreenRecording
    End Sub
    Manifest
    Code:
    AddApplicationText(
        <
    service android:name="com.hbisoft.hbrecorder.ScreenRecordService">
            <
    intent-filter >
                <action android:name=
    "com.hbisoft.hbrecorder.ScreenRecordService" />
            </
    intent-filter >
        </
    service>)
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice