I have Qt application which allows users to watch a stream, and record this stream if needed.The interface looks as follows;
https://imgur.com/a/CGB8vP7
So "Open Stream Button" allows user to watch a specific stream and "Record Stream Button" displays and record the stream simultaneously. So far everything is fine. My problem is that when the user watches the stream and wants to record it, I have to stop the Vlc instance and open the media with new parameters. What I want to do is record the stream without stopping VLC media. Here's a part of my code;
TO DISPLAY STREAM:
Code: Select all
QString url = "udp://@239.255.255.10:1234";
VlcMedia media = new VlcMedia(url, instance);
VlcMediaPlayer *player = new VlcMediaPlayer(instance);
player->open(media);
Code: Select all
player->stop();
QString recordOption = ":sout=#duplicate{dst=display, dst=std{access=file,mux=ts,dst=save.ts}}";
libvlc_media_add_option(media->core(), recordOption.toUtf8().data());
player->open(media);
NOTE: I tried this creating two different VLC instances and two different player instances. But in that case, if I open a stream with one player, the other player doesnt record the stream at all. I think the reason behind it is that both players are trying to listen to the same udp port, and only one of them can access.