Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] Does anyone know a media format which can be recorded and played on both android and iOS in this package? #67

Closed
kbanta11 opened this issue Feb 24, 2021 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@kbanta11
Copy link

Up until recently, I was able to use the WellKnownMediaFormats.adtsAac to record audio that would be playable on both Android and iOS (after being uploaded to firebase). Recently, it seems audio recorded on Android has changed slightly in format. The filetype in firebase used to be just simply audio/aac for both android and iOS recordings/uploads. However, recently, when recordings are made with sounds on Android, the are show as audio/X-HX-AAC-ADTS which cannot be played on iOS. Was there a change made to Android's media encoders/formats? Or is there another solution that a file can be both recorded and played back on iOS and Android?

@kbanta11 kbanta11 added the help wanted Extra attention is needed label Feb 24, 2021
@kbanta11
Copy link
Author

I created a custom media format that seems to work saving the files as mp4's:

class CustomMediaFormat extends NativeMediaFormat {
  /// ctor
  const CustomMediaFormat({
    int sampleRate = 16000,
    int numChannels = 1,
    int bitRate = 16000,
  }) : super.detail(
    name: 'aac',
    sampleRate: 16000,
    numChannels: 1,
    bitRate: 16000,
  );

  @override
  String get extension => 'aac';

  // Whilst the actual index is MediaRecorder.AudioEncoder.AAC (3)
  @override
  int get androidEncoder => 3;

  /// MediaRecorder.OutputFormat.MP4
  @override
  int get androidFormat => 2;

  /// kAudioFormatMPEG4AAC
  @override
  int get iosFormat => 1633772320;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant