Maui
                                
                                 Maui copied to clipboard
                                
                                    Maui copied to clipboard
                            
                            
                            
                        [BUG] MediaElement doesn't play video from URL
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
Hi
Visual Studio 2022 Preview
<toolkit:MediaElement 
    x:Name="MediaElement" 
    Source="https://api.met.no/weatherapi/geosatellite/1.4/.mp4"
    ShouldShowPlaybackControls="True" 
    ShouldAutoPlay="True"
    HeightRequest="300"
    WidthRequest="300" />
No
CommunityToolkit.Maui.MediaElement = 3.0.1
Expected Behavior
Visual Studio 2022
<xct:MediaElement Source="https://api.met.no/weatherapi/geosatellite/1.4/.mp4"
          ShowsPlaybackControls="True" 
                  HeightRequest="300"
                  WidthRequest="300"
                  />
Yes
Xamarin.CommunityToolkit=2.0.6
Steps To Reproduce
Open and run solution from repository
Link to public reproduction project repository
https://github.com/Jan6501/MauiApp1a
Environment
- .NET MAUI CommunityToolkit: 3.0.1
- OS: Android
- .NET MAUI: 8.0.6
Anything else?
No response
Hi @Jan6501 I think your public reproduction repository is currently set to private as I am unable to access it. Can you please check that?
Also what exactly is the issue that you are seeing here? The video doesn't play? Doesn't auto play? Or something else?
https://github.com/Jan6501/MauiApp1a
hi
"The video doesn't play?"
no
Jan
Android = no iOS = yes Windows = yes
?
Error codename: ERROR_CODE_IO_BAD_HTTP_STATUS, Error message: Source error
HTTP/1.1 206 Partial Content
That API appears to use device detection. If I load it in Chrome it then loads a web page and a javascript player which shows the weather as a web app. That makes it hard to figure out the best way to load the player. It honestly depends on how the http request is done. I think if we want to add support for this we would have to know more about how the API works. ATM we support file urls from the web and device. If we want to add additional support and allow further configuration you should open a discussion and suggest an API. We can see what support we get from the community. @vhugogarcia
Thanks @Jan32 and @ne0rrmatrix for the feedback. I also reviewed this issue and I noticed that this page https://api.met.no/weatherapi/geosatellite/1.4/.mp4 may be returning an invalid status code, since it is returning a 206 partial content as you mentioned it.
After reviewing also directly with the Android ExoPlayer repository, I found out this issue: https://github.com/google/ExoPlayer/issues/10537 that the only way to support partial content status is by using a custom LoadControl.
I am not sure if we should support partial content status code or no in Android, and I don't have experience creating a custom LoadControl, but others may have experience and can give us some hand.
By the information mentioned above, I am moving this to a discussion since it is a nice to have feature, so we can discuss more in depth the implications and define the next steps there.