ryanheise / just_audio

Audio Player
1.03k stars 655 forks source link

Issue in iOS using setSpeed #1010

Open CeesJanNolen opened 1 year ago

CeesJanNolen commented 1 year ago

Which API doesn't behave as documented, and how does it misbehave? The SetSpeed API in this library doesn't work as expected for me in iOS. I've implemented this feature both in iOS and Android. In Android I'm experiencing no issues, but in iOS a small noise / audio distortion is noticable.

Minimal reproduction project Provide a link here using one of two options:

late final AudioManager _manager;
_manager.setSpeed(1.01);

To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior: Apply the same setSpeed as mentioned in iOS and you notice some audio noise / distortion

Error messages N.A.

Expected behavior We're expecting the iOS app to behave as the Android app, which does just increase speed without any noise added. iOS: https://drive.google.com/file/d/10OS3EgWkwAWkgDUvj3lViKE9wKEfpOPe/view?usp=drivesdk Android: https://drive.google.com/file/d/1IPXaeEYdmPni1Bx4_22Qi14rSB6_D3E-/view?usp=drivesdk

Screenshots / recordings Please see the two video's of the same track. Android and iOS and note the difference.

Smartphone (please complete the following information):

Plugin is working awesome so far! Any help would be appreciated! Thanks in advance!

CeesJanNolen commented 1 year ago

We did some more testing and used different XCode and flutter versions to see if it would make any change. Sadly no differences in there.

Flutter doctor from Mac:

[✓] Flutter (Channel stable, 3.10.4, on macOS 13.4 22F66 darwin-arm64, locale
    en-NL)
    • Flutter version 3.10.4 on channel stable at
      /Users/flappsmacmini/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 682aa387cf (9 days ago), 2023-06-05 18:04:56 -0500
    • Engine revision 2a3401c9bb
    • Dart version 3.0.3
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at /Users/flappsmacmini/Library/Android/sdk
    • Platform android-31, build-tools 31.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.12.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4 22F66 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 114.0.5735.133

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Hopefully you can find something!

ryanheise commented 1 year ago

This is unfortunately the native behaviour of iOS, not specifically the behaviour of just_audio.

CeesJanNolen commented 1 year ago

Is there a possible workaround for this? Or will we be stuck to the native behaviour of iOS?

ryanheise commented 1 year ago

It is possible to do something more low-level based on AVAudioEngine. There are efforts at #784 which you can try, which already implements setSpeed using the low level APIs.

CeesJanNolen commented 1 year ago

Thanks! Although swift isn't really our expertise, we'll try if that works for us!