xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.59k stars 475 forks source link

[Bug] Media Element Not Playing MP3s. #395

Open musictopia2 opened 4 years ago

musictopia2 commented 4 years ago

Description

If I have the IsVisible to false in the media element, then it will not play any songs. Also, even if IsVisible is true, if i don't specify the area to be filled and expanded, then it won't play songs. There are many cases where a person may want to play a song but not see anything else so other controls can be there and they can still play the song. In the WPF MediaElement, if Visibility is hidden, a person can still play a song. Same thing should happen even with xamarin forms.

Steps to Reproduce

  1. Set IsVisible to false.
  2. Set source to song.

Expected Behavior

Still hear the song because you put the path in there and wanted to play the song.

Actual Behavior

Nothing happens. No errors. But nothing plays either.

Basic Information

Screenshots

Reproduction Link

Workaround

jsuarezruiz commented 4 years ago

I have created a reproduction sample: Issue10428.zip

@musictopia2 In which platform do you have the problem?. If you try the sample you can hear the audio with a hidden MediaElement (tested on iOS).

musictopia2 commented 4 years ago

I was using android.

musictopia2 commented 4 years ago

I tried the sample and it would not even let me put on the device. I created a blank app and it had no problem. The error was "The project Issue10428.Android needs to be deployed before it can be started. Verify the project is selected to be deployed in the Solution Configuration Manager."

musictopia2 commented 4 years ago

The good news is I was able to copy the xaml

to another project and it was able to load. The bad news is even with that xaml, if IsVisible was false, no sounds played. However, if I specified IsVisible as true, then it worked fine. This means that still does not work. If you want me to post to my git, i can. However, to test, just create a new project with that xaml to show it happening.

hartez commented 4 years ago

I tried the sample and it would not even let me put on the device. I created a blank app and it had no problem. The error was "The project Issue10428.Android needs to be deployed before it can be started. Verify the project is selected to be deployed in the Solution Configuration Manager."

Just open up the solution configuration and check the "Deploy" checkbox next to the Android project.

hartez commented 4 years ago

With the repro project from @jsuarezruiz - the sound will play on iOS if the MediaElement has IsVisible="False", but on Android nothing plays. So we need to make all the platforms behave in the same way.

musictopia2 commented 4 years ago

How do I get to solution configuration. I have visual studio 2019 community edition and don't even see solution configuration. The good news is since I was able to copy the xaml to another project, then i was able to deploy that to show the problem.

hartez commented 4 years ago

How do I get to solution configuration. I have visual studio 2019 community edition and don't even see solution configuration.

In the Solution Explorer, right-click the solution - Configuration Manager should be one of the context menu options.

Awesomer9561 commented 1 year ago

Hi, any update on this? I am also facing the same issue.