Skip to content

PlatformException(record, Failed to start recording, Format conversion is not possible., null) #565

@mattpodolak

Description

@mattpodolak

Package version
6.1.2

Environment

  • OS: ios

Describe the bug

Trying to resume recording and i keep getting this error preventing me from being able to record again. It only happens after I've been recording for a bit and then stop, and maybe do this a couple times, and then it breaks and is unresumable.

    return RecordConfig(
      encoder: AudioEncoder.pcm16bits,
      sampleRate: sampleRate,
      numChannels: 1,
      androidConfig: const AndroidRecordConfig(
        manageBluetooth: true,
        audioSource: AndroidAudioSource.defaultSource,
        audioManagerMode: AudioManagerMode.modeNormal,
      ),
      iosConfig: const IosRecordConfig(
        categoryOptions: [
          IosAudioCategoryOption.allowBluetooth,
          IosAudioCategoryOption.allowBluetoothA2DP,
          IosAudioCategoryOption.defaultToSpeaker,
        ],
      ),
    );

NOTE: i also use a managed audio session with these settings:

    _session = await AudioSession.instance;
    await _session.configure(
      AudioSessionConfiguration(
        avAudioSessionCategory: AVAudioSessionCategory.playAndRecord,
        avAudioSessionCategoryOptions:
            AVAudioSessionCategoryOptions.mixWithOthers |
                AVAudioSessionCategoryOptions.allowBluetooth,
        avAudioSessionMode:
            AVAudioSessionMode.spokenAudio,
        androidAudioAttributes: const AndroidAudioAttributes(
          usage: AndroidAudioUsage.voiceCommunication,
          contentType: AndroidAudioContentType.speech,
        ),
      ),

To Reproduce

Steps to reproduce the behavior:

    final config = _buildRecordConfig(sampleRate);
    Stream<Uint8List> stream;

    try {
      stream = await _audioRecorder.startStream(config);
    } catch (e, stack) {
      logger.severe('Failed to start audio recorder stream');
      logger.severe('Error: $e');
      logger.severe('Stack trace: $stack');
      await _stopRecorderStream(state);
      rethrow;
    }

Expected behavior

I expect to be able to resume a recording, this worked with flutter sound, exact same setup - I've only started seeing this issue after switching to your package.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions