Is there a way to buffer a video before playing it?

This forum is about all development around libVLC.
DanielK117
New Cone
New Cone
Posts: 6
Joined: 20 Feb 2021 20:56

Is there a way to buffer a video before playing it?

Postby DanielK117 » 04 Apr 2021 12:51

Is there any way to buffer a video before it plays?

My current play logic is implemented as follows:

Code: Select all

media = new Media(vlc, nextMediaItem.FileNameWithPath); videoClipMediaPlayer.Media = media; this.videoClipMediaPlayer.Play();
Currently, buffering happens only when the Play() function is called.
In order to play videos more smoothly, I would like to buffer the video already when the user has selected a video.
Is there a way to start buffering before the play() function?

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Is there a way to buffer a video before playing it?

Postby Rémi Denis-Courmont » 04 Apr 2021 18:38

You can provide custom stream input callbacks if you want finer control over that. At least with the native API.

See documentation.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

SteelyJim
New Cone
New Cone
Posts: 1
Joined: 10 May 2021 01:23

Re: Is there a way to buffer a video before playing it?

Postby SteelyJim » 10 May 2021 01:30

I record video to a disc file and play it back simultaneously with LibVLCSharp media player. I always make sure the playback always is at least 10 seconds behind the recording. Without buffering, playback is pretty rough. This code smooths it out...

Core.Initialize();
string[] options = new string[1];
options[0] = "--disc-caching=3000";
fLibVLC = new LibVLC(options);

SteelyJim


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 20 guests