Error in streaming audio files over http on ios 12 real devices and simulator of any ios version
Which API doesn't behave as documented, and how does it misbehave? streaming audio files over http on ios 12 real devices and any simulator
Minimal reproduction project Provide a link here using one of two options: the example to reproduce the bug I simply changed the URL in the main screen to be http instead of https
To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:
- Open app
Error messages
Error loading audio source: (-11800) The operation could not be completed
Expected behavior Correct audio playback
Smartphone (please complete the following information):
-
Device:
-
real iPhone6 - OS: iOS12.4
-
simulator iPhone 11 Pro Max - OS: iOS15.0
Flutter SDK version
[✓] Flutter (Channel stable, 2.5.0, on macOS 12.0.1 21A559 darwin-arm, locale en-EG)
• Flutter version 2.5.0 at /Users/ammar/Documents/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (7 months ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 13.1, Build version 13A1030d
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google [Chrome.app/Contents/MacOS/Google](http://chrome.app/Contents/MacOS/Google) Chrome
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
[✓] VS Code (version 1.62.3)
• VS Code at /Users/ammar/Downloads/Visual Studio [Code.app/Contents](http://code.app/Contents)
• Flutter extension version 3.29.0
[✓] Connected device (2 available)
• iPhone 13 Pro Max (mobile) • B211D18D-FD0A-45D2-83D9-5A449960DB13 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome
100.0.4896.88
Additional context the same example works fine on all ios 13+ real phones, and all android real phones and emulator
@ryanheise waiting for your response. Thank you
I haven't gotten around to testing your issue yet, but you can also try the alternative approach listed here:
https://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http
Since this behaviour affects any iOS app, not just Flutter apps, the above S/O post should be directly applicable.
The provided Minimal reproduction project already uses that approach, and the problem is still not resolved
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
As it turns out, that plist configuration you've given should work, while the one in the official example doesn't. The key NSAllowsArbitraryLoadsForMedia should be removed since it causes NSAllowsArbitraryLoads to be ignored on newer versions of iOS.
I have updated the example accordingly. Can you try testing the example now by changing the audio URL from https to http and see if it works?
Sorry for the late reply, My example already includes NSAllowsArbitraryLoadsForMedia that's why it didn't work.
https://github.com/Qariah/just_audio_http_issue/blob/e5a731e27d933f4ca476236e9d31d02ddf964917/just_audio/example/ios/Runner/Info.plist#L9
I don't have the iPhone 6 device right now, I will bring it from a friend and test again.
Thanks for your response.