How can I pass a type argument IntPtr
to a VideoView
in Xamarin?
I obtain a stream from a video recorder using some of the manufacturer's own libraries (Which do not have much documentation) and I cannot implement the stream to one VideoView
as I say.
I'm really not sure how I did it so I'm going to leave the code that works for me in C# in a project Windows Forms
that does work for me, and in turn put the part of what I'm trying to do in Xamarin
.
C# functional code Windows Forms
:
//Por aquí arriba hay configuración de direcciones ip y credenciales para el objeto.
var info = new CHCNetSDK.LPNET_DVR_PREVIEWINFO();
info.hPlayWnd = VideoBox.Handle; //Declaro por donde se va a reproducir el Stream
CHCNetSDK.NET_DVR_RealPlay_V40(idConexion,ref info, null, User); //Inicia el Stream
VideoBox
it is(PictureBox)
Code NOT functional in
Xamarin
:
Attempt 1 using MediaController
:
var mediaController = new MediaController();
info.hPlayWnd = mediaController.Handle;
videoView.setMediaController(mediaController);
CHCNetSDK.NET_DVR_RealPlay_V40(idConexion,ref info, null, User);
videoView.Start();
I try 2 removing MediaController
only withVideoView
When I have tried it with the videoView the only difference is that I have removed the lines in which it is referenced mediaController
by doing:
info.hPlayWnd = videoView.Handle;
videoView.Start();
I try 3 using ImageView
as ifPictureBox
info.hPlayWnd = imageView.Handle;
CHCNetSDK.NET_DVR_RealPlay_V40(idConexion,ref info, null, User);
As I say, it has never worked for me. It does not return any kind of exception, VideoView
it just stays black. I can ensure that the resource to which I try to connect works 100%.
Any ideas to port the code from Windows Forms
to Android
or some alternative?
I have found a solution for this, as the stream can be seen from any browser I have chosen to use WebView to be able to visualize the "stream" which actually appears to be a sequence of images and deny the zoom and movements of the webview so that it appears that way a video.
C# code: