Search code examples
xamarin.formslinphonelinphone-sdk

Linphone and Xamarin Forms; how to set remote and local views?


Based on the Linphone Windows 10 app implementation, I am able to view remote and local video by setting the properties Linphone.Core.NativeVideoWindowId and NativePreviewVideoWindowId to the respective Name:s of two Windows.UI.Xaml.Controls.SwapChainPanel controls.

When using Linphone in a corresponding Xamarin Android or iOS app, which UI control(s) should then be used, and which control property should be used to define the NativeVideoWindowId and NativePreviewVideoWindowId on those platforms?


Solution

  • I have had the similar question.

    Android:

    videoView = new GL2JNIView(context);
    surfaceView = new SurfaceView(context);
    

    Assigning via the custom renderer, for example ViewRenderer<CameraPreview, Droid.Lib.CameraPreview>

    iOS:

     var wrapper = (Xamarin.Forms.Platform.iOS.NativeViewWrapper)contentViewVideoParent.Content;
                    var videoview = (UIView)wrapper.NativeView;
    

    And assigning IntPtr videoview.Handle to the linphone view.