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

Commit

Permalink
[MediaElement] Removed line that pauses player before setting it to n…
Browse files Browse the repository at this point in the history
…ull. (#9531)

* Removed Pause in MediaElement Dispose method

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.

* removed if app and changed video source

* Revert sln

This reverts commit 7a8d7d8.

Co-authored-by: Samantha Houts <samhouts@users.noreply.github.com>

fixes #9525
  • Loading branch information
StevenGranados authored Aug 4, 2020
1 parent 2b66939 commit 9f3410b
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System.Collections.Generic;
using System.Reflection;
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()
{
Device.SetFlags(new List<string>(Device.Flags ?? new List<string>()) { "MediaElement_Experimental" });

PushAsync(CreateRoot());
}
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://sec.ch9.ms/ch9/80a3/6563611f-6a39-44fa-a768-1a58bdd080a3/HotRestart.mp4",
HeightRequest=200,
},
button
}
}
};

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


#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 @@ -269,6 +269,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue9833.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue9929.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 @@ -129,7 +129,6 @@ protected override void Dispose(bool disposing)

RemoveStatusObserver();

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

base.Dispose(disposing);
Expand Down

0 comments on commit 9f3410b

Please sign in to comment.