CommunityToolkit / CommunityToolkit/Maui
[BUG] MediaElement on iOS cant load or play media from an indirect url (Windows and Android works)
- Dominant language
- C#
- Stars
- 2.7k
- Forks
- 500
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Did you read the "Reporting a bug" section on Contributing file?
- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
### Current Behavior
MediaElement on iOS cant load or play media from an indirect url
When I say "indirect" url, I mean something like:
https://example.com/audioplayer.php?path=/hiddenpath/cool.mp3
an easily accessible url looks like:
https://example.com/cool.mp3
Android and windows have no problem playing the media from either type of url, but iOS cant load the media from the "indirect" url. This is true with any type of media. Ive tested this with mp3,mp4 and wav files.
### Expected Behavior
any type of url can be a media source for Media Element
### Steps To Reproduce
run the example object, notice the indirect url source on iOS does not load, however, it will load with windows or Android
### Link to public reproduction project repository
https://github.com/kablammyman/mediaelementbug.git
### Environment
```markdown
- .NET MAUI CommunityToolkit,MediaElement: 3.1.1
- OS: iOS
- .NET MAUI: 8.0.40
```
### Anything else?
So, I made a sample test. I placed an 2 copies of audio file on my webserver. One copy of the file is in an easily accessible location, while the other copy can only be accessed via a php script. The php "redirection" is how i add a lil bit of obscurity to my media so anyone cant just steal my content (easily).
Heres the issue, Android and Windows have no issues accessing the media using the indirect url but iOS cant. However, when the media is in an easily accessible location, the iOS version of mediaElement works just fine.
When I say "indirect" url, I mean something like:
https://example.com/audioplayer.php?path=/hiddenpath/cool.mp3
an easily accessible url looks like:
https://example.com/cool.mp3
I think this also applies to IAudioPlayer since I'm getting the same behavior.
Im not sure if what Im trying is "allowed" on iOS or if I need to change my approach or change the settings to make this work like on the other platforms
Contributor guide
Research direction
Start with the linked mediaelementbug.git reproduction and run its MediaElement example on iOS, comparing the direct and PHP-mediated media URLs with Android or Windows. Investigate the iOS MediaElement path, then verify that indirect mp3, mp4, and wav URLs load and play as expected, including the reported IAudioPlayer behavior if relevant.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, ios
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100