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

Unable to play a remote file recorded on Android on iOS #155

Closed
urbanmania opened this issue Nov 17, 2019 · 11 comments · Fixed by #167
Closed

Unable to play a remote file recorded on Android on iOS #155

urbanmania opened this issue Nov 17, 2019 · 11 comments · Fixed by #167
Labels
help wanted Extra attention is needed

Comments

@urbanmania
Copy link

Version of flutter_sound - 1.5.2

flutter doctor

[✓] Flutter (Channel unknown, v1.9.1+hotfix.6, on Mac OS X 10.15.1 19B88, locale en-IS)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Community Edition (version 2019.2.4)
[✓] VS Code (version 1.40.0)
[✓] Connected device (3 available)

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

I expect to be able to record on Android and play on Android or iOS (after uploading to a server)
I expect to be able to record on iOS and play on iOS or Android (after uploading to a server)

Actual behavior

I can record on iOS and play on iOS or Android
I can record on Android and play on Android
I can NOT record on Android and play on iOS

Tested environment (Emulator? Real Device?)

Both emulator and real device

Steps to reproduce the behavior

Record on Android, upload to Firesbase and try to play on iOS (works if you play the clip on Android)

@DyaryRaoof
Copy link

Same issue here. Have you tried any thing new? Any updates @urbanmania ?

@urbanmania
Copy link
Author

@DyaryRaoof no, I haven't tried anything, decided to work on other things in my app and see if @hyochan would respond in the meantime. I do have to start work on this part of the app soon tho' so if I find a solution that works I'll post hit here, hope you do as well :)

@DyaryRaoof
Copy link

Sure. Thanks for responding.

@hyochan hyochan added the help wanted Extra attention is needed label Dec 7, 2019
@hyochan
Copy link
Collaborator

hyochan commented Dec 7, 2019

If you give the sound type to AAC before recording, it will be played on both platforms. However, this will reduce the sound quality because the format isn't what's primarily supported especially in android. You can see our discussion.

Therefore, I'd recommend you to convert the audio that is compatible with both platforms such as mp3 with popular library ffmpeg. This is how I've overcomed this issue myself when I worked on COONI.

@alexda12
Copy link

alexda12 commented Dec 7, 2019

@hyochan This really is a critical issue. A USEFUL plugin cannot only support one platform and the recommendation to use a third party package such as ffmpeg is not practical considering the overhead it takes in terms of additional packages that is required. The way ffmpeg works is to spawn a task via execute the additional packages that will be packaged up with your flutter app. This is completely unacceptable, not viable and an under-performing solution/recommendation. Can you imagine packaging your app on the various playstores/app stores using this recommended solution ??

AAC is supported by both Android and iOS however as commented in #95 and #79 - It seems there is an ongoing issue with this plugin WRT quality of sound in Android .

@hyochan This would have been a really GREAT plugin for Flutter but until the Sound Quality for Android is resolved AND the issue being able to create recordings/playback in BOTH platforms - then unfortunately all the hardwork you have done in maintaining this plugin is regrettably wasted....

@hyochan
Copy link
Collaborator

hyochan commented Dec 7, 2019

@alexda12 I was talking about converting your sound with ffmpeg on backend.

Well I feel bit needless to say what you have pointed out since we all know what is ideal. Since we do not have much resources to bring that up in current repo, I have just given you a work around idea and shared how I have manually overcomed it for now.

If there is a better solution please bring that up and help the community instead of saying what should be done. I was meant to share my whole work myself to help others who maybe trying the same thing over.

Since I have exposed all the parameters given in Android, I think you may try out some other extensions that may sound with better quality and share us to move forward.

I can't drive myself further if there isn't productive assistance since I've put quite an effort already that I know of.

Some productive communication would be something like
dooboolab-community/react-native-iap#863

@alexda12
Copy link

alexda12 commented Dec 7, 2019

@hyochan Forgive me. My intention was not meant to sound ungrateful or put down the amazing work you have contributed to the community. I agree - lets start a discussion as to how we can all move forward to make this work - I know Java, Swift and Flutter so can contribute accordingly , first is to start the discussion and isolate the issue and come up with an alternative to a) Sort out the sound issues and b) Make this work on all platforms.

How do you suggest we proceed ?

@hyochan
Copy link
Collaborator

hyochan commented Dec 7, 2019

Thanks for understanding. Actually I don't know yet. I want some others to debug on the poor sound issue in android with aac if this feature is critical to their work. I might have to research on this further either.

Currently, not much trials have been given yet and I am not currently using this plugin in my work (I moved company) so the plugin has become bit idle :(

hyochan added a commit that referenced this issue Dec 8, 2019
+ Set android default encoding option to `AAC`.
+ Fix android default poor sound.
  - Resolve [#155](#155)
  - Resolve [#95](#95)
  - Resolve [#75](#79 Set android default encoding option to `AAC`.
+ Fix android default poor sound.
  - Resolve [#155](#155)
  - Resolve [#95](#95)
  - Resolve [#75](#79)
hyochan added a commit that referenced this issue Dec 8, 2019
Make ios & android audio format compatible by default

+ Set android default encoding option to `AAC`.
+ Fix android default poor sound.
  - Resolve [#155](#155)
  - Resolve [#95](#95)
  - Resolve [#75](#79 Set android default encoding option to `AAC`.
+ Fix android default poor sound.
  - Resolve [#155](#155)
  - Resolve [#95](#95)
  - Resolve [#75](#79)

* Fix default file extension to aac

* Revert default sample rate and num channel
@hyochan
Copy link
Collaborator

hyochan commented Dec 8, 2019

@alexda12 I've been debugging today with the issue and I found out that the default sampleRate and numChannel passed down to android cause a problem which is needed in ios (ios set default to numChannel = 2 and sampleRate = 44100). However, I'm not sure what values to set in android when the default encoding output format is set to AAC. For default encoding it was fine to pass above values.

Please check out 1.6.0 and see if it fulfills your requirement.

@urbanmania
Copy link
Author

@hyochan thanks so much for this. I haven't done extensive testing on this, but thought I should tell you that I'm now able to record on Android and play on iOS!! Much appreciated!

@SunitRoy02
Copy link

@hyochan thanks so much for this. I haven't done extensive testing on this, but thought I should tell you that I'm now able to record on Android and play on iOS!! Much appreciated!

Can you please explain what actually you did to solve this?
thank you in advance

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

Successfully merging a pull request may close this issue.

5 participants