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

[Bug] MediaElement will crash when page popup #581

Closed
jessejiang0214 opened this issue Jul 12, 2020 · 6 comments
Closed

[Bug] MediaElement will crash when page popup #581

jessejiang0214 opened this issue Jul 12, 2020 · 6 comments
Labels
a/MediaElement bug Something isn't working. Breaky break. p/iOS iOS platform issue. s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged.

Comments

@jessejiang0214
Copy link
Contributor

Description

The App will crash when leaving the page which has MediaElement.

Steps to Reproduce

  1. Use the MediaElement demo https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/userinterface-mediaelementdemos/
  2. Launch the App goto Custom Transport page
  3. Click Play and pause a few times and then click stop, then go back the front page

Expected Behavior

The App still running

Actual Behavior

The App is froze

Basic Information

  • Version with issue:
  • Last known good version: 4.7.0.968
  • IDE:VS for Mac 8.6.5
  • Platform Target Frameworks:
    • iOS: 13.5
    • Android:
    • UWP:
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices:

Screenshots

Reproduction Link

Workaround

@jessejiang0214
Copy link
Contributor Author

jessejiang0214 commented Jul 12, 2020


=================================================================
	Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x109b50865 - /Users/jesse/Library/Developer/CoreSimulator/Devices/465D08FB-DB0E-4769-B61B-DE866514827F/data/Containers/Bundle/Application/5EFF8C35-8E04-4B31-9699-0FF41504D265/MediaElementDemos.iOS.app/MediaElementDemos.iOS : mono_dump_native_crash_info
	0x109b453c5 - /Users/jesse/Library/Developer/CoreSimulator/Devices/465D08FB-DB0E-4769-B61B-DE866514827F/data/Containers/Bundle/Application/5EFF8C35-8E04-4B31-9699-0FF41504D265/MediaElementDemos.iOS.app/MediaElementDemos.iOS : mono_handle_native_crash
	0x109b5715b - /Users/jesse/Library/Developer/CoreSimulator/Devices/465D08FB-DB0E-4769-B61B-DE866514827F/data/Containers/Bundle/Application/5EFF8C35-8E04-4B31-9699-0FF41504D265/MediaElementDemos.iOS.app/MediaElementDemos.iOS : mono_sigsegv_signal_handler_debug
	0x7fff51c005fd - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
	0xc104fa00c104f700 - Unknown
	0x7fff258f25a3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : NSKeyValueWillChangeWithPerThreadPendingNotifications
	0x7fff2095ec53 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVPlayer setRate:withVolumeRampDuration:playImmediately:rateChangeReason:]
	0x7fff2095f01a - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVPlayer setRate:]
	0x109d73929 - /Users/jesse/Library/Developer/CoreSimulator/Devices/465D08FB-DB0E-4769-B61B-DE866514827F/data/Containers/Bundle/Application/5EFF8C35-8E04-4B31-9699-0FF41504D265/MediaElementDemos.iOS.app/MediaElementDemos.iOS : xamarin_dyn_objc_msgSend
	0x1108998f2 - Unknown

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7fff50ba75f1):0x7fff50ba75e1  08 5b 41 5e 41 5f 5d c3 48 85 ff 7e 09 48 8b 07  .[A^A_].H..~.H..
0x7fff50ba75f1  8a 40 1c 24 01 c3 31 c0 c3 48 85 ff 74 17 78 1d  .@.$..1..H..t.x.
0x7fff50ba7601  48 8b 07 48 85 c0 74 0d 48 89 c7 be 01 00 00 00  H..H..t.H.......
0x7fff50ba7611  e9 a0 d4 00 00 48 8d 05 5b 1c 02 00 c3 48 89 f8  .....H..[....H..

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at ObjCRuntime.Messaging:void_objc_msgSend <0x000e1>
	  at AVFoundation.AVPlayer:Pause <0x00122>
	  at Xamarin.Forms.Platform.iOS.MediaElementRenderer:Dispose <0x00253>
	  at Foundation.NSObject:Dispose <0x00074>
	  at Xamarin.Forms.Platform.iOS.VisualElementPackager:Dispose <0x002c5>
	  at Xamarin.Forms.Platform.iOS.VisualElementPackager:Dispose <0x00071>
	  at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1:Dispose <0x0024a>
	  at Foundation.NSObject:Dispose <0x00074>
	  at Xamarin.Forms.Platform.iOS.DisposeHelpers:DisposeModalAndChildRenderers <0x0030f>
	  at Xamarin.Forms.Platform.iOS.Platform:HandleChildRemoved <0x000d2>
	  at Xamarin.Forms.Element:OnDescendantRemoved <0x00120>
	  at Xamarin.Forms.Element:OnChildRemoved <0x00182>
	  at Xamarin.Forms.VisualElement:OnChildRemoved <0x00092>
	  at Xamarin.Forms.Page:OnInternalRemoved <0x00140>
	  at Xamarin.Forms.Page:InternalChildrenOnCollectionChanged <0x002c2>
	  at System.Collections.ObjectModel.ObservableCollection`1:OnCollectionChanged <0x000fa>
	  at System.Collections.ObjectModel.ObservableCollection`1:OnCollectionChanged <0x00103>
	  at System.Collections.ObjectModel.ObservableCollection`1:RemoveItem <0x0018a>
	  at System.Collections.ObjectModel.Collection`1:Remove <0x001e5>
	  at <Xamarin-Forms-INavigationPageController-RemoveAsyncInner>d__75:MoveNext <0x006d2>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start <0x00222>
	  at Xamarin.Forms.NavigationPage:Xamarin.Forms.INavigationPageController.RemoveAsyncInner <0x001b2>
	  at <UpdateFormsInnerNavigation>d__78:MoveNext <0x0035f>
	  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x001fa>
	  at Xamarin.Forms.Platform.iOS.NavigationRenderer:UpdateFormsInnerNavigation <0x0016a>
	  at <DidMoveToParentViewController>d__45:MoveNext <0x001c2>
	  at System.Runtime.CompilerServices.AsyncVoidMethodBuilder:Start <0x0020a>
	  at ParentingViewController:DidMoveToParentViewController <0x00182>
	  at <Module>:runtime_invoke_void__this___object <0x001ab>
	  at <unknown> <0xffffffff>
	  at UIKit.UIApplication:UIApplicationMain <0x00254>
	  at UIKit.UIApplication:Main <0x000b2>
	  at UIKit.UIApplication:Main <0x00132>
	  at MediaElementDemos.iOS.Application:Main <0x00092>
	  at <Module>:runtime_invoke_void_object <0x00198>
=================================================================


Error in Output

@jessejiang0214
Copy link
Contributor Author

Hi Team,

I just found we cannot call _avPlayerViewController?.Player?.Pause(); when the render is disposing. For now, the temp solution is removing the Pause functions from Dispose and ElementChange function and manage the play status from code.

But we still need a solid solution for this.

Thanks

@jsuarezruiz jsuarezruiz self-assigned this Jul 13, 2020
@jessejiang0214
Copy link
Contributor Author

Hi Team,

Just want to follow up, any ETA for this? My customer wants to ship this feature to Production ASAP.

@jessejiang0214
Copy link
Contributor Author

Hi team.

I found another crash from AppCenter

MediaElementRenderer2.MediaElementVolumeRequested (System.Object sender, System.EventArgs e)
MediaElementRenderer2.MediaElementStateRequested (System.Object sender, Xamarin.Forms.StateRequested e)
MediaElement.Stop ()

It's better to fix them together.

@jsuarezruiz jsuarezruiz transferred this issue from xamarin/Xamarin.Forms Nov 18, 2020
@jfversluis
Copy link
Member

Hi Jessie! Thanks for reporting this. There has been shuffling with the MediaElement and it now lives in the Toolkit with us.

Would you be able to check if the bug still happens in our code? I know there have been some bugfixes in the meantime. Thanks!

@jfversluis jfversluis added a/MediaElement bug Something isn't working. Breaky break. p/iOS iOS platform issue. s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged. labels Nov 18, 2020
@AndreiMisiukevich
Copy link
Contributor

I presume this bug is fixed (at least because now we don't override Dispose method for iOS MediaElement renderer)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/MediaElement bug Something isn't working. Breaky break. p/iOS iOS platform issue. s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged.
Projects
MediaElement
Awaiting triage
Development

No branches or pull requests

4 participants