Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTK# / Xamarin.Forms.Gtk implementations (reloaded) #20

Conversation

jeremyVignelles
Copy link
Collaborator

@jeremyVignelles jeremyVignelles commented Nov 14, 2018

replaces #2
Due to the recent changes in the libvlcsharp, too many conflicts prevented the proper merge of #2.

This is a new, better implementation. It should fix cross-platform build issues, but it still needs to be confirmed. (My msbuild on my linux has been broken by an update : mono/linux-packaging-msbuild#8 )

Forms.GTK# also works! The initialization bug does not affect us anymore due to the fact that the media player is now given externally.

Checklist

  • Write the code for the Gtk# implementation
  • Write the code for Xamarin.Forms using the GTK# backend
  • Make it work on Windows
  • Make it work on Linux
  • Make it work on MacOS
  • Check that the Forms.Gtk sample works on all three platforms
  • Write installation instructions on all 3 platforms

/cc @mfkl @Ch4rg3r

@mfkl
Copy link
Member

mfkl commented Nov 15, 2018

Well done!

LibVLCSharp.Gtk/VideoView.cs Outdated Show resolved Hide resolved
LibVLCSharp.Gtk/VideoView.cs Outdated Show resolved Hide resolved
@mfkl
Copy link
Member

mfkl commented Nov 15, 2018

get => (int)Environment.OSVersion.Platform == 6;
returns 4 (Unix) on macOS. Only way around it is to start a new process and check for the name "darwin", ugh

@mfkl
Copy link
Member

mfkl commented Nov 15, 2018

This fails on GTK.Mac

return IsMac ? Native.dlopen(libraryPath) : Native.LoadLibrary(libraryPath);

No idea why, no logs... same libvlc gets loaded fine in the Xamarin.Mac Cocoa sample, and I got it working before... meh

@jeremyVignelles
Copy link
Collaborator Author

For your two remarks about mac, I just copy-pasted what you did, I didn't really understand.
== 6 seems magic, while there is an enum value (see what I did on linux)

@mfkl
Copy link
Member

mfkl commented Nov 15, 2018

== 6 seems magic, while there is an enum value (see what I did on linux)

It was needed magic, unfortunately it does not work. https://github.com/dotnet/corefx/issues/19694
NET Classic minimum supported target on Mac will be net471

@mfkl
Copy link
Member

mfkl commented Nov 15, 2018

  • libvlc for mac seems to be included 1/2 times when rebuilding... weird. Always fine with netcore targets
  • I managed to build and run the sample on mac, only from CLI. Running with VS is not possible as the dylib is not copied to output (but building with CLI it is, most of the time)
  • dlopen of libvlc on Linux is missing.
  • And last but not least, here's a weird one: The second I touch the GTK videoview on mac with the mouse cursor, it crashes with
Stack overflow in unmanaged: IP: 0x107261f69, fault addr: 0x7ffeec73eff8
Stack overflow: IP: 0x107261f69, fault addr: 0x7ffeec735ff8
Stacktrace:
  at <unknown> <0xffffffff>
  at Gtk.Application.Run () [0x00001] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/gtk-sharp-None/gtk/Application.cs:145
  <...>
  at LibVLCSharp.GTK.Sample.Program.Main () [0x0009d] in /Users/Martz/Projects/LibVLCSharp/Samples/LibVLCSharp.GTK.Sample/Program.cs:35
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0004d] in <71f4e3d7d65e42b0a699d02e59766d3c>:0

@jeremyVignelles
Copy link
Collaborator Author

Merged @mfkl 's suggestions into my branch and rebased / squashed the commits.

@mfkl : What's left to do on your side with Mac?

For linux, everything builds fine thanks to instructions here : mono/linux-packaging-msbuild#7, but I still can't build the Forms.Gtk.Sample :

Microsoft (R) Build Engine version 15.8.0.0 ( Thu Nov 15 18:28:44 CET 2018) pour Mono
Copyright (C) Microsoft Corporation. Tous droits réservés.

La génération a démarré 15/11/2018 21:29:31.
Projet "/data/projects/dotnet/libvlcsharp/Samples/Forms/LibVLCSharp.Forms.Sample.GTK/LibVLCSharp.Forms.Sample.GTK.csproj" sur le nœud 1 (cibles par défaut).
/data/projects/dotnet/libvlcsharp/Samples/Forms/LibVLCSharp.Forms.Sample.GTK/LibVLCSharp.Forms.Sample.GTK.csproj(151,5): error : Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : ../../../packages/Xamarin.Forms.3.2.0.871581/build/netstandard2.0/Xamarin.Forms.props.
Génération du projet "/data/projects/dotnet/libvlcsharp/Samples/Forms/LibVLCSharp.Forms.Sample.GTK/LibVLCSharp.Forms.Sample.GTK.csproj" terminée (cibles par défaut) -- ÉCHEC.

ÉCHEC de la build.

"/data/projects/dotnet/libvlcsharp/Samples/Forms/LibVLCSharp.Forms.Sample.GTK/LibVLCSharp.Forms.Sample.GTK.csproj" (cible par défaut) (1) ->
(EnsureNuGetPackageBuildImports cible) -> 
  /data/projects/dotnet/libvlcsharp/Samples/Forms/LibVLCSharp.Forms.Sample.GTK/LibVLCSharp.Forms.Sample.GTK.csproj(151,5): error : Ce projet fait référence à des packages NuGet qui sont manquants sur cet ordinateur. Utilisez l'option de restauration des packages NuGet pour les télécharger. Pour plus d'informations, consultez http://go.microsoft.com/fwlink/?LinkID=322105. Le fichier manquant est : ../../../packages/Xamarin.Forms.3.2.0.871581/build/netstandard2.0/Xamarin.Forms.props.

    0 Avertissement(s)
    1 Erreur(s)

Temps écoulé 00:00:00.45

It tells me it can't find ../../../packages/Xamarin.Forms.3.2.0.871581/build/netstandard2.0/Xamarin.Forms.props, despite having run msbuild /t:Restore, which does nothing (or at least doesn't install anything at the path specified). Any idea @jsuarezruiz ?

@mfkl
Copy link
Member

mfkl commented Nov 19, 2018

@mfkl : What's left to do on your side with Mac?

The stackoverflow when the mouse cursor touches the GTK DrawingArea would be the last blocker.

The rest is just annoying but we can ship without (CLI only, VS4Mac crashes when editing GTK projects).
I have tried a few things on the libvlc side (i.e. mp.EnableMouseInput false/true) and on the GTK side but no clue... Have to use gdb.
Note that I can grab and move the window no problem, it crashes only when the cursor comes in contact with the DrawingArea.

For linux, can you write a small instruction guide to get proper libvlc (for ubuntu at least) and whatever else is needed to get the sample running? Will add it to the gitlab wiki page.

@jeremyVignelles jeremyVignelles force-pushed the feature/gtk-sharp-reloaded branch 2 times, most recently from 0f21261 to f55b986 Compare December 1, 2018 12:02
@jeremyVignelles
Copy link
Collaborator Author

I managed to make the Xamarin.Forms sample work on linux: I fixed the project reference path (linux is case-sensitive) and restored the packages with nuget install -OutputDirectory ../../../packages in the Samples/Forms/LibVLCSharp.Forms.Sample.GTK folder.

It works well, but it's quite manual. Shall we switch to a SDK-style project instead? Shall we make a template project?

@mfkl
Copy link
Member

mfkl commented Jan 3, 2019

Shall we switch to a SDK-style project instead?

Sure. Are you saying that would help fix the manual restore part?

Shall we make a template project?

Not sure what you mean. Sample project?

@jeremyVignelles
Copy link
Collaborator Author

jeremyVignelles commented Jan 3, 2019

Sure. Are you saying that would help fix the manual restore part?

I guess: instead of nuget install, dotnet build automatically restores the packages. I need to test if it works

Not sure what you mean. Sample project?

A repo project that can be used to dotnet new VideoLAN.LibVLCSharp.Forms.GTK. I need to look how it works.

@jeremyVignelles
Copy link
Collaborator Author

jeremyVignelles commented Jan 17, 2019

Current status: Almost done. ✔️

Remaining:

@jbkempf
Copy link

jbkempf commented Jan 20, 2019

I'd argue you should merge without macOS for now.

@mfkl
Copy link
Member

mfkl commented Jan 20, 2019

I'd argue you should merge without macOS for now.

That's the plan.

@mfkl
Copy link
Member

mfkl commented Jan 21, 2019

Merged a927af5.

Good job 👍

@mfkl mfkl closed this Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants