I am developing a project based on ADB to transmit mobile phone screen, and transmit H264 video stream to PC through socket, but LibVLCSharp is in a frozen screen situation after playing, the screen is always kept at the first frame, and the screen is not updated
TCSocketServer.GetObject().streamReceiver += (byte[] buffer) =>
{
var media = new Media(_libvlc, new StreamMediaInput(new MemoryStream(buffer)));
Dispatcher.Invoke(new Action(() =>
{
this.VideoView.MediaPlayer.Play(media);
}));
};
LibVLC init
LibVLC _libvlc = new LibVLC("--demux=H264", "--rawvid-fps=24");
The picture is always in the state of the first frame, and the picture cannot be updated Freeze screen
You can't do it that way : you would receive a byte array, and only this byte array would be read.
Do you have a Stream that represents your socket that you could use directly? An intermediate MemoryStream won't help because it would declare the size of the stream to be what's currently inside. That would work only if you had downloaded your entire video before playing it.
You could use a Pipe in-between, as shown in this (paid) sample :
https://github.com/jeremyVignelles/libvlcsharp-nonfree-samples/blob/main/Common/PipeMediaInput.cs