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

fix: Audio not working in iOS 17 for UrlSource #1767

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

samdeane
Copy link

This is a re-tread of @andyshephard's PR #1728 (comment).

It looks like the tests are failing on that one (maybe just because linting is failing?), so I've recreated it in a place where I can potentially fix it.

@Gustl22
Copy link
Collaborator

Gustl22 commented Mar 14, 2024

Hey @samdeane I already was working on fixing this PR in #1763, where I also included some tests.

But I still struggle to make it work on macOS 14. I don't have a Mac (only validating via CI), so maybe you can help me out there.
I prefer a proper solution, which also fixes the other bugs.

@samdeane
Copy link
Author

I can take a look, but I don't have a lot of time to spend on it, unfortunately.

Do you know what is failing on your #1763 branch? It looks like the iOS tests are failing along with the macOS 14 ones?

@Gustl22
Copy link
Collaborator

Gustl22 commented Mar 15, 2024

The thing is I tried to make data uris work on ios 16 and 17. And there I need two different sets of options. And in xcode for ios 16 the option for ios 17 is not recognized, although it is wrapped within #available see:

Swift Compiler Error (Xcode): Cannot find 'AVURLAssetOverrideMIMETypeKey' in scope 

/Users/runner/work/audioplayers/audioplayers/packages/audioplayers_darwin/darwin/Classes/WrappedMediaPlayer.swift:184:36

And macOS 14 is failing in the tests regardless of my changes.

I guess we have to rebuild the ios/macos folder with the new flutter version and do a pod install to work properly. (Just a guess)

@samdeane
Copy link
Author

This is likely to be the problem on mac-os. The tests are throwing up a system dialogue and will hang until it goes away.

image

Need to take a look at the code signing options to see why that dialogue is appearing.

@samdeane
Copy link
Author

There's a difference between testing for iOS 16 and building with an old version of XCode that only knows about iOS 16.

To use the code wrapped in #available you still have to be building against a version of the SDK that knows about that version - which means using a Github Actions mac runner with Xcode 15.

@samdeane
Copy link
Author

samdeane commented Mar 15, 2024

It looks like the GH actions macos-13 image has Xcode 15 installed, and also has both the iOS 16 and ios 17 SDKs, so using that should be sufficient: https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md.

You should be able to test the different iOS builds by just picking a different simulator.

This stuff here is picking the device to run on: ```
UDID=$(xcrun simctl list devices | grep "iPhone" | sed -n 1p | grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})")
echo "Using simulator $UDID"
xcrun simctl boot "${UDID:?No Simulator with this name iPhone found}"


It just picks the first device, which is fairly random.

You could instead use simctl to create test devices with specific device/sdk combinations, and then run the tests on each on in turn.

Something like: ```
UDID=$(xcrun simctl create test-se-17-4 com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation com.apple.CoreSimulator.SimRuntime.iOS-17-4)
xcrun simctl boot "${UDID:?No Simulator with this name iPhone found}"

@Gustl22
Copy link
Collaborator

Gustl22 commented Mar 15, 2024

Thank you for your help and the detailed answers!

This is likely to be the problem on mac-os. The tests are throwing up a system dialogue and will hang until it goes away.

The thing is, it passes several tests, but not the others. So this is unlikely to be a signing problem, I think:
https://github.com/bluefireteam/audioplayers/actions/runs/8293438418/job/22696520861?pr=1769

I vaguely remember to change the app id or team id to some random one in order to work locally:
Something like this: https://stackoverflow.com/questions/77457132/every-time-i-run-my-app-in-xcode-it-asks-if-im-sure-i-want-to-allow-it-to-run

To use the code wrapped in #available you still have to be building against a version of the SDK that knows about that version - which means using a Github Actions mac runner with Xcode 15.

Yeah that's what I thought, too.

It looks like the GH actions macos-13 image has Xcode 15 installed, and also has both the iOS 16 and ios 17 SDKs, so using that should be sufficient

But it seems, that I have to build with xcode 15, and then somehow run on XCode 14 in order to get the required iOS version 16. 16 is not available on XCode 15 (macOS 13).

You could instead use simctl to create test devices with specific device/sdk combinations, and then run the tests on each on in turn.

Thank you :) That's what I actually tried here, but fails, because ios 16 is not available in that XCode version.
1471576

@samdeane
Copy link
Author

But it seems, that I have to build with xcode 15, and then somehow run on XCode 14 in order to get the required iOS version 16. 16 is not available on XCode 15 (macOS 13).

16 is not available by default on Xcode 15, but it is installable. That GH page I linked to implied that a number of SDKs are installed on the macos-13 image, including both the 16 and 17 ones. If I get time I can try a few experiments but you should be able to install and run with the iOS 16 SDK on Xcode 15.

@Gustl22
Copy link
Collaborator

Gustl22 commented Mar 15, 2024

Ok thanks for your help. I appreciate it. I try to get it working ;D

@samdeane
Copy link
Author

If I get some time, I will experiment and let you know what I come up with.

@Gustl22
Copy link
Collaborator

Gustl22 commented Mar 15, 2024

I finally got ios 16 working, by switching with sudo xcode-select -switch /Applications/Xcode_14.3.1.app/Contents/Developer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants