Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Removed Pause in MediaElement Dispose method
Browse files Browse the repository at this point in the history
I think the pause is there to stop background playback of the mediaelement, but since the next line also seems to stop it, I removed the line.
  • Loading branch information
StevenGranados committed Feb 12, 2020
1 parent 2197b95 commit 39339d5
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System.Collections.Generic;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.ManualReview)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 9525, "MediaElement Disposing exception when MainPage is changed on iOS", PlatformAffected.iOS)]
public class Issue9525 : TestNavigationPage
{
protected override void Init()
{
#if APP
Device.SetFlags(new List<string>(Device.Flags ?? new List<string>()) { "MediaElement_Experimental" });

PushAsync(CreateRoot());
#endif
}
private ContentPage CreateRoot()
{
var button = new Button
{
AutomationId = "Issue9525Button",
Text = "Go to new page",
};
button.Clicked += Button_Clicked;
return new ContentPage
{
Content = new StackLayout
{
Children =
{
new MediaElement
{
AutomationId = "Issue9525MediaElement",
Source="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
HeightRequest=200,
},
button
}
}
};

}
private void Button_Clicked(object sender, System.EventArgs e)
{
Navigation.InsertPageBefore(CreateRoot(), CurrentPage);
PopAsync().Wait();
}


#if UITEST
[Test]
public void Issue9525Test()
{
//Will be exeption if fail.
RunningApp.Screenshot("I am at Issue9525");
for (var i = 0; i < 10; i++)
{
RunningApp.WaitForElement(q => q.Marked("Issue9525Button"));
RunningApp.Screenshot("I see the Button");
RunningApp.Tap("Issue9525Button");
}
}
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue9355.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue8784.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue9360.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue9525.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RefreshViewTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7338.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ScrollToGroup.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ protected override void Dispose(bool disposing)

RemoveStatusObserver();

_avPlayerViewController?.Player?.Pause();
_avPlayerViewController?.Player?.ReplaceCurrentItemWithPlayerItem(null);

base.Dispose(disposing);
Expand Down

0 comments on commit 39339d5

Please sign in to comment.