Skip to content

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

Closed

Description

@kbanta11

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?

Activity

  1. added
    help wanted
    on Feb 24, 2021
  2. kbanta11 commented on Feb 28, 2021

    @kbanta11
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions