public void StartRecording()
    {
        var sampleRate   = 44100;
        var channelCount = 1;

        // Start recording from the main camera
        recordingClock = new RealtimeClock();
        videoRecorder  = new MP4Recorder(videoWidth, videoHeight, 30, sampleRate, channelCount, OnRecording);
        cameraInput    = new CameraInput(videoRecorder, recordingClock, Camera.main);
        // Start the microphone
        audioDevice = AudioDevice.GetDevices()[0];
        audioDevice.StartRecording(sampleRate, channelCount, this);
    }