Page 1 of 1

LibVLCSharp.Forms - Trouble switching pages

Posted: 18 Sep 2018 01:09
by Rickers
Hello,

When switching pages using Xamarin.Forms, LibVLCSharp seems to throw a fit, specifically when navigating away from a page with the LibVLCSharp implementation. It's very easy to replicate, on my machine at least, by downloading the LibVLCSharp's samples (i.e. https://github.com/videolan/libvlcsharp) and adding a simple page change. Below is the error I receive, as well as the code for the two pages I use.

So to reiterate,
-Xamarin.Forms (Sample seems to come with 3.0.0.446417)
-Latest LibVLCSharp sample code (as of 18/09/2018 09:03 AEST or 17/09/2018 23:03 GMT)
-Add a new page, and navigate to it from the page with the LibVLCSharp implementation
-Run iOS example code (i.e. LibVLCSharp.Forms.Sample.iOS)
-Observe error????

Error

Code: Select all

2018-09-18 08:21:05.072 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: Stacktrace: 2018-09-18 08:21:05.072 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at <unknown> <0xffffffff> 2018-09-18 08:21:05.073 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at (wrapper managed-to-native) LibVLCSharp.Shared.MediaPlayer/Native.LibVLCMediaPlayerSetNsobject (intptr,intptr) [0x0000a] in <847eb8651d0b443393ba31624bef2516>:0 2018-09-18 08:21:05.073 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at LibVLCSharp.Shared.MediaPlayer.set_NsObject (intptr) [0x00000] in C:\Users\dog\OneDrive\Documents\Projects\testing\libvlcsharp-master\LibVLCSharp\Shared\MediaPlayer.cs:755 2018-09-18 08:21:05.073 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at LibVLCSharp.Platforms.iOS.VideoView.Detach () [0x00000] in C:\Users\dog\OneDrive\Documents\Projects\testing\libvlcsharp-master\LibVLCSharp\Platforms\iOS\VideoView.cs:24 2018-09-18 08:21:05.073 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at LibVLCSharp.Platforms.iOS.VideoView.Dispose (bool) [0x00009] in C:\Users\dog\O neDrive\Documents\Projects\testing\libvlcsharp-master\LibVLCSharp\Platforms\iOS\VideoView.cs:30 2018-09-18 08:21:05.073 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/Foundation/NSObject2.cs:147 2018-09-18 08:21:05.073 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at LibVLCSharp.Forms.Platforms.iOS.VideoViewRenderer.Dispose (bool) [0x00009] in C:\Users\dog\OneDrive\Documents\Projects\testing\libvlcsharp-master\LibVLCSharp.Forms\Platforms\iOS\VideoViewRenderer.cs:40 2018-09-18 08:21:05.074 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Foundation.NSObject.Dispose () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/Foundation/NSObject2.cs:147 2018-09-18 08:21:05.074 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.Platform.iOS.Platform.DisposeModelAndChildrenRenderers (Xamarin.Forms.Element) [0x00038] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:238 2018-09-18 08:21:05.074 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.Platform.iOS.Platform.System.IDisposable.Dispose () [0x00048] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:84 2018-09-18 08:21:05.074 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x00022] in D:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:181 2018-09-18 08:21:05.074 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.ApplicationOnPropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) [0x00012] in D:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:142 2018-09-18 08:21:05.074 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.BindableObject.OnPropertyChanged (string) [0x0000a] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:153 2018-09- 18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.Element.OnPropertyChanged (string) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:402 2018-09-18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Xamarin.Forms.Application.set_MainPage (Xamarin.Forms.Page) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\Application.cs:98 2018-09-18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at LibVLCSharp.Forms.Sample.MainPage/<>c.<get_ChangeToMain>b__4_1 () [0x00001] in C:\Users\dog\OneDrive\Documents\Projects\testing\libvlcsharp-master\LibVLCSharp.Forms.Sample\LibVLCSharp.Forms.Sample\MainPage.xaml.cs:33 2018-09-18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/Foundation/NSAction.cs:152 2018-09-18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at (wrapper run time-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <3c7b99a36820490fb2cbc5a6fc6b06d8>:0 2018-09-18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at <unknown> <0xffffffff> 2018-09-18 08:21:05.075 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) [0x0005c] in <4ab8db046af64ab0ae036378dae8bfd3>:0 2018-09-18 08:21:05.076 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/UIKit/UIApplication.cs:79 2018-09-18 08:21:05.076 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at UIKit.UIApplication.Main (string[],string,string) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.14.0.14/src/Xamarin.iOS/UIKit/UIApplication.cs:63 2018-09-18 08:21:05.076 LibVLCSharp.Forms.Sample.iOS[34124:547 7535] critical: at LibVLCSharp.Forms.Sample.iOS.Application.Main (string[]) [0x00001] in C:\Users\dog\OneDrive\Documents\Projects\testing\libvlcsharp-master\LibVLCSharp.Forms.Sample\LibVLCSharp.Forms.Sample.iOS\Main.cs:17 2018-09-18 08:21:05.076 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00051] in <dad3fc70e9dd4c74aaa688b503fc7d6b>:0 2018-09-18 08:21:05.076 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: Native stacktrace: 2018-09-18 08:21:05.129 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 0 LibVLCSharp.Forms.Sample.iOS 0x000000010e4de544 mono_handle_native_crash + 244 2018-09-18 08:21:05.129 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 1 LibVLCSharp.Forms.Sample.iOS 0x000000010e4ecfd0 mono_sigsegv_signal_handler + 288 2018-09-18 08:21:05.129 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 2 libsystem_platform.dylib 0x0000000121404f5a _sigtramp + 26 2018-09-18 08:21:05.129 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 3 ??? 0x0000ffff00001fa3 0x0 + 281470681751459 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 4 ??? 0x00000001402a9553 0x0 + 5371499859 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 5 ??? 0x000000014014995c 0x0 + 5370059100 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 6 ??? 0x0000000140146ba0 0x0 + 5370047392 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critic al: 7 ??? 0x000000013e6204fe 0x0 + 5341578494 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 8 LibVLCSharp.Forms.Sample.iOS 0x000000010e4f00f3 mono_jit_runtime_invoke + 1443 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 9 LibVLCSharp.Forms.Sample.iOS 0x000000010e5d7cd4 mono_runtime_try_invoke + 148 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 10 LibVLCSharp.Forms.Sample.iOS 0x000000010e5d9ab6 mono_runtime_invoke + 38 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 11 LibVLCSharp.Forms.Sample.iOS 0x000000010e3bcaf8 _ZL31native_to_managed_trampoline_20P11objc_objectP13objc_selectorPP11_MonoMethodj + 248 2018-09-18 08:21:05.130 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 12 LibVLCSharp.Forms.Sample.iOS 0x000000010e3c1074 -[__MonoMac_NSAsyncActionDispatcher xamarinApplySelector] + 52 2018-09-18 08:2 1:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 13 Foundation 0x000000011e74fd5e __NSThreadPerformPerform + 330 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 14 CoreFoundation 0x000000011f71cbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 15 CoreFoundation 0x000000011f701574 __CFRunLoopDoSources0 + 468 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 16 CoreFoundation 0x000000011f700a6f __CFRunLoopRun + 1263 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 17 CoreFoundation 0x000000011f70030b CFRunLoopRunSpecific + 635 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 18 GraphicsServices 0x00000001216e4a73 GSEventRunModal + 62 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 19 UIKit 0x000000011c554057 UIApplicationMain + 159 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: 20 ??? 0x000000013f6422ae 0x0 + 5358494382 2018-09-18 08:21:05.131 LibVLCSharp.Forms.Sample.iOS[3412 4:5477535] critical: 21 ??? 0x000000013f642043 0x0 + 5358493763 2018-09-18 08:21:05.132 LibVLCSharp.Forms.Sample.iOS[34124:5477535] critical: ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. =================================================================

MainPage.xaml

Code: Select all

<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:shared="clr-namespace:LibVLCSharp.Forms.Shared;assembly=LibVLCSharp.Forms" x:Class="LibVLCSharp.Forms.Sample.MainPage"> <Grid HorizontalOptions="Fill" VerticalOptions="Fill"> <shared:VideoView x:Name="videoView" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/> <Label Text="Please work!" HorizontalOptions="Center" VerticalOptions="End" BackgroundColor="White" TextColor="Black"> <Label.GestureRecognizers> <TapGestureRecognizer Command="{Binding ChangeView}" ></TapGestureRecognizer> </Label.GestureRecognizers> </Label> </Grid> </ContentPage>

MainPage.xaml.cs

Code: Select all

[XamlCompilation(XamlCompilationOptions.Compile)] public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); this.BindingContext = this; } protected override void OnAppearing() { base.OnAppearing(); videoView.MediaPlayer.Play(new Media(videoView.LibVLC,"http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4", Media.FromType.FromLocation)); } private ICommand changeView; public ICommand ChangeView { get { if (this.changeView== null) { this.changeView= new Command(() => { App.Current.MainPage = new LibVLCSharp.Forms.Sample.Page1(); }); } return this.changeView; } } }

Page1.xaml

Code: Select all

<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="LibVLCSharp.Forms.Sample.Page1"> <ContentPage.Content> <StackLayout> <Label Text="App is not crashing!" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"> </Label> </StackLayout> </ContentPage.Content> </ContentPage>

Page1.xaml.cs

Code: Select all

[XamlCompilation(XamlCompilationOptions.Compile)] public partial class Page1 : ContentPage { public Page1() { InitializeComponent(); } }
Please let me know if any more information is needed.

Cheers,
Rickers

Re: LibVLCSharp.Forms - Trouble switching pages

Posted: 18 Sep 2018 08:41
by mfkl