object:startRecording()

Type Function
Object Recording
Library media.*
Return value none
Revision Release 2024.3703
Keywords startRecording, audio recording
See also media.newRecording()
object:stopRecording()

Overview

Start recording audio.

Gotchas

General

Starting an audio recording will stop any audio playback. You cannot record and play audio at the same time.

Android

To enable audio recording on Android devices, you must set the permission level in the build.settings file.

settings =
{
    android =
    {
        usesPermissions =
        {
            "android.permission.RECORD_AUDIO",
        },
    },
}

Syntax

object:startRecording()

Example

local filePath = system.pathForFile( "newRecording.aif", system.DocumentsDirectory )
local r = media.newRecording( filePath )
r:startRecording()