iOS Question Record audio file on iOS

mtechteam

Member
Licensed User
Longtime User
Is it possible with B4i to record an audio file and get access to it so that it can be uploaded somewhere (for example DropBox)?

I see the built in app iPhone has called Voice Memo, but can't find anything on the forum of how I might interact with it from my app.

Thanks
 

Alex_197

Well-Known Member
Licensed User
Longtime User
B4X:
Private recorder As AudioRecorder 'iMedia library


Sub btnRecord_Click
    Try
        pg.ResignFocus
        If File.Exists(File.DirDocuments,VoiceMessageFileName)=True Then
           
            Dim sf As Object = XUI.Msgbox2Async("Do you want to record audio file again?", "HCMS", "Yes", "", "No", Null)
            Wait For (sf) Msgbox_Result (Result As Int)
           
            If Result <> XUI.DialogResponse_Positive Then              
                Return
            End If
                       
            Dim Del As Boolean
            Del=File.Delete(File.DirDocuments,VoiceMessageFileName)          
            Log("File " & VoiceMessageFileName & " deleted " & Del & " before recording")          
        End If
       
        Buttons("Record")
        StartRecording
   
    Catch
        Log("btnRecord_Click " &  LastException.description)      
    End Try
End Sub

Sub StartRecording
    Try
       

        recorder.Initialize(AudioFileDir,VoiceMessageFileName, 44100, True, 16, False)

        lblTimer.Text=""
        recordingStart = DateTime.Now
        timer2.Enabled=True
        Timer2_Tick
        recorder.Record
        Log("StartRecording")
   
    Catch
        Log("StartRecording " & LastException.description)
    End Try
   
End Sub

Sub StopRecording
   
    Try
        timer2.Enabled=False
        recorder.Stop
        Log("StopRecording")
       
    Catch
        Log("StopRecording " & LastException.description)
    End Try
   
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…