Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
869 stars 568 forks source link

[BUG]: Duration null for remote audio file #613

Closed jcblancomartinez closed 3 years ago

jcblancomartinez commented 3 years ago

Flutter Sound Version :

Severity

Your problem

Describe the bug

[BUG]: Duration null for remote audio file (i.e. https://xxx/flutter_sound_yyy.aac)

To Reproduce Steps to reproduce the behavior:

  1. Invoke await flutterSoundHelper.duration('https://xxx/flutter_sound_yyy.aac')

Logs!!!!

D/flutter-ffmpeg( 2759): Getting media information for https://xxx/flutter_sound_yyy.aac. I/mobile-ffmpeg( 2759): https protocol not found, recompile FFmpeg with openssl, gnutls or securetransport enabled. I/mobile-ffmpeg( 2759): https://xxx/flutter_sound_yyy.aac: Protocol not found

Larpoux commented 3 years ago

flutterSoundHelper.duration() does not work on a remote file. If you want to have informations on a remote file, you must download it.

Eventually this can be improved in a future versions

jcblancomartinez commented 3 years ago

That would be a nice feature. Other plugins like just_audio have it already.

Thanks.

jcblancomartinez commented 3 years ago

@Larpoux

FYI.

I added flutter_ffmpeg: ^0.3.0 as dependency and tried the following and it worked:

MediaInformation info = await FlutterFFprobe().getMediaInformation('https://xxx/flutter_sound_yyy.aac');
Map<dynamic, dynamic> mediaProperties = info.getMediaProperties();
double seconds = double.parse(mediaProperties['duration']);
Larpoux commented 3 years ago

This is weird. Flutter Sound just calls ffmpeg. If ffmpeg works, Flutter Sound should work too. I am going to look to this.

jcblancomartinez commented 3 years ago

It might be related to the version of flutter_ffmpeg.

They seem to have done some non-backwards compatible changes like change of the data structure returned by getMediaInformation.

Larpoux commented 3 years ago

Yes, I think you are right.

BTW, other Flutter Sound users complained that Flutter Sound and flutter_ffmpeg are incompatible, and that they have duplicates symbols when they add flutter_ffmpeg as a dependency of their app.

This is something (near) the top of my todo stack. I am surprised that you are able to do it.

jcblancomartinez commented 3 years ago

Yes, you are right. I was forced to remove flutter_sound as dependency to be able to run the above test.

Regards.

Larpoux commented 3 years ago

585

jcblancomartinez commented 3 years ago

Thanks.

jcblancomartinez commented 3 years ago

@Larpoux is this something you are planning to solve in the upcoming 4 weeks? If not, I will need to change the plugin.

Thanks.

Larpoux commented 3 years ago

Yes @jcblancomartinez . This bug in on top of my todolist. Unfortunately I work on τ half time, because I have another important project waiting for me. So things are sometimes long to be solved. I am sorry, I do my best ...

jcblancomartinez commented 3 years ago

@Larpoux I understand it and I appreciate your dedication. I will check the status of this in 4 weeks and I will make a decision then.

Larpoux commented 3 years ago

Actually I am fighting with terrible asynchronous problems. The way τ handle asynchronous events is not good. But τ is at the middle of an App which does anythings and an OS which does what it wants.

Asynchronous processing is very very hard to handle correctely and need many tests before release. And even after many tests, I will not be sure that Flutter Sound users will not have problems.

Larpoux commented 3 years ago

@jcblancomartinez ,

I solved the incompatibility issue with flutter_ffmpeg. I will do several tests tomorrow and I will release a new Flutter Sound version.

I hope that I am not too late for your project.

jcblancomartinez commented 3 years ago

Hi @Larpoux,

I appreciate your update. Good luck with the testing!!

You are in time :)

Thanks.

Regards.

Larpoux commented 3 years ago

Fixed in Flutter Sound release 7.6.3 You can read this

jcblancomartinez commented 3 years ago

Hi @Larpoux ,

I've upgraded flutter_sound to 7.6.3+2 and I'm getting null duration for both local and remote files:

Duration d = await flutterSoundHelper.duration

Could you please confirm it is working for you?

Thanks.

Larpoux commented 3 years ago

@jcblancomartinez ,

Yes, you are right : there is something wrong in 7.6.3 with getDuration(). 👎 I am very sorry. I am working on that, and I will tell you when it will be fixed.

jcblancomartinez commented 3 years ago

@Larpoux no need to be sorry :). I actually appreciate your dedication.

Thanks.

Larpoux commented 3 years ago

@jcblancomartinez ,

7.6.4 is released. I hope that this release is better.

rayliverified commented 3 years ago

Was FFMPEG incorrectly included in Flutter Sound Lite?

v7.6.4 of flutter_sound_lite fails to build with the following error.

F:\Development\flutter-sdk\.pub-cache\hosted\pub.dartlang.org\flutter_sound_lite-7.6.4+2\android\src\main\java\com\dooboolab\fluttersound\FlutterSound.java:65: error: cannot find symbol
            FlutterSoundFFmpeg.attachFFmpegPlugin( Flauto.androidContext, registrar.messenger ()  );
            ^
  symbol:   variable FlutterSoundFFmpeg
  location: class FlutterSound
Larpoux commented 3 years ago

@searchy2 , I am sorry. I did something wrong yesterday. I am going to fix that this morning.

Larpoux commented 3 years ago

@searchy2 , I built a new release. I hope it is better, now.

jcblancomartinez commented 3 years ago

@Larpoux should I try get duration against the new build or you haven't tested that yet?

Thanks.

Larpoux commented 3 years ago

Yes, you can try version 7.6.5

rayliverified commented 3 years ago

Incredible, thanks for the quick turnaround and maintaining this library!

Is there a sponsor link?

jcblancomartinez commented 3 years ago

@Larpoux it works like a charm.

Thank you so much!!

Larpoux commented 3 years ago

Yeah! 💯

rayliverified commented 3 years ago

@Larpoux The error that was introduced breaks iOS as well. Please release a fix for iOS when you are able. Thank you!

 In file included from
    /Users/ray/Development/NOCDiOS/my_flutter/.ios/Pods/Target Support
    Files/flutter_sound_lite/flutter_sound_lite-umbrella.h:14:
    /Users/ray/.pub-cache/hosted/pub.dartlang.org/flutter_sound_lite-7.6.5+1/ios
    /Classes/FlutterSoundFFmpeg.h:24:9: fatal error:
    'mobileffmpeg/MobileFFmpegConfig.h' file not found
    #import <mobileffmpeg/MobileFFmpegConfig.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    /Users/ray/Development/NOCDiOS/my_flutter/.ios/Flutter/FlutterPluginRegistra
    nt/Classes/GeneratedPluginRegistrant.m:26:9: fatal error: could not build
    module 'flutter_sound_lite'
    #import <flutter_sound_lite/FlutterSound.h>
     ~~~~~~~^
Larpoux commented 3 years ago

@searchy2 ,

Flutter Sound 7.7.0 is released. I really hope that the problems that you have with the LITE flavor are fixed, now.

jcblancomartinez commented 3 years ago

@Larpoux Resolving as this has been implemented.

Thanks for your support.