In a C# application I use LibVLC via NuGet packages.
I have created a MemoryStream and gave it to Media:
MemoryStream buffer = new MemoryStream();
bool playing = false;
public void dataArrived(byte[] d) {
buffer.Write(d, 0, d.Length);
if (!playing) {
playing = true;
mediaPlayer.Play(new Media(LibVLC, buffer));
}
}
Now dataArrived
is called when data is arrived from the network (this is a live stream).
Data is a valid mp4 stream (fragmented, plays nicely in HTML5 Video).
However VLC is not displaying it. In the log I see a lot of messages about prefetch:
prefetch stream debug: end of stream
VLC can read and dump the boxes, however there is a message (debug, not error!) which might be interesting:
mp4 demux debug: unrecognized major media specification (iso5).
Then there is another interesting batch of messages:
mp4 demux warning: cannot select track[Id 0x1]
main input debug: EOF reached
main decoder debug: killing decoder fourcc `h264'
main decoder debug: removing module "avcodec"
main demux debug: removing module "mp4"
mp4 demux debug: freeing all memory
main input debug: Program doesn't contain anymore ES
Is there some trick (config) for LibVLC to play fragmented mp4 on the fly (data is not available in advance)?
Or maybe MemoryStream
is a wrong choice for this purpose?