I'm writing a Video Player with Qt5::QMediaPlayer to play randomly some videos for a randomly duration as this:
int main(int argc, char *argv[]) {
    QApplication a(argc, argv);
    QMediaPlaylist* playlist = new QMediaPlaylist(&a);
    playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/A-060405V4651.WMV"));
    playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/E-102604.WMV"));
    playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/C-102304.WMV"));
    QMediaPlayer* player = new QMediaPlayer(&a);
    player->setPlaylist(playlist);
    QVideoWidget* videoWidget = new QVideoWidget;
    player->setVideoOutput(videoWidget);
    player->play();
    videoWidget->show();
    QTimer* t = new QTimer;
    QObject::connect(t, &QTimer::timeout, [&](){
        playlist->setCurrentIndex(playlist->nextIndex());
        player->play();
        videoWidget->setWindowTitle(playlist->currentMedia().canonicalUrl().fileName());
        t->start((qrand()%5 + 5)*1000);
    });
    t->start((qrand()%5 + 5)*1000);
    QTimer* t2 = new QTimer;
    QObject::connect(t2, &QTimer::timeout, [&](){
        player->setPosition(qrand() % player->duration());
        videoWidget->setWindowTitle(playlist->currentMedia().canonicalUrl().fileName());
        t2->start((qrand()%2 + 2)*1000);
    });
    t2->start((qrand()%2 + 2)*1000);
    return a.exec();
}
There are two issues:
1. When change the position
player->setPosition(qrand() % player->duration());
there are a bit delay (my client can accept this, but smoothly is better)
2. When the video source changed with:
playlist->setCurrentIndex(playlist->nextIndex());
player->play();
there are a small duration black screen that the client doesn't want. He want the effect at least same as when changing the postion:
player->setPosition(qrand() % player->duration());
Can we remove this black screen when changing the video source with Qt5 on Windows? Or we can do this with other libraries/frameworks (play a list of videos without black screen gap when change the video source)? (On MacOs, the switching is smooth)
Thank you very much!