Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[BUG] MediaElement doesn't play video from URL

Open Jan6501 opened this issue 1 year ago • 7 comments

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 Screenshot_1706087193

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 Screenshot_1706087224

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

Jan6501 avatar Jan 25 '24 06:01 Jan6501

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?

bijington avatar Jan 25 '24 09:01 bijington

https://github.com/Jan6501/MauiApp1a

Jan6501 avatar Jan 25 '24 10:01 Jan6501

hi

"The video doesn't play?"

no

Jan

Jan32 avatar Jan 26 '24 14:01 Jan32

Android = no iOS = yes Windows = yes

Jan32 avatar Feb 01 '24 13:02 Jan32

?

Jan32 avatar Mar 20 '24 14:03 Jan32

Error codename: ERROR_CODE_IO_BAD_HTTP_STATUS, Error message: Source error

Jan32 avatar Mar 21 '24 07:03 Jan32

HTTP/1.1 206 Partial Content

Jan32 avatar Mar 21 '24 09:03 Jan32

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

ne0rrmatrix avatar Jun 18 '24 05:06 ne0rrmatrix

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.

vhugogarcia avatar Jun 18 '24 14:06 vhugogarcia