Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Video loop glitch



  • Hi Guys
    My code to loop a background video is below which works fine.
    When it gets to the end of the video and restarts there is a brief black screen before it resumes.
    Is there any way to avoid this?
    I was looking at this thread and it appears it may be a bug.
    https://stackoverflow.com/questions/33472761/windows-qt5-qmediaplayer-qmediaplaylist-tiny-duration-black-screen-when-th

    		QMediaPlaylist *aos_dm = new QMediaPlaylist;
    		QMediaPlaylist *aos_nm = new QMediaPlaylist;
    		aos_nm->addMedia(QUrl::fromLocalFile(QDir::currentPath() + "\\Resources\\videos\\nm_animation_1.mp4"));		
    		aos_nm->setCurrentIndex(0);
    		aos_nm->setPlaybackMode(aos_nm->Loop);
    
    		aos_dm->addMedia(QUrl::fromLocalFile(QDir::currentPath() + "\\Resources\\videos\\dm_animation_1.mp4"));
    		aos_dm->setCurrentIndex(0);
    		aos_dm->setPlaybackMode(aos_dm->Loop);
    
    		player->setPlaylist(aos_dm);
    
    		videoWidget = new QVideoWidget(mstrWnd);
    		player->setVideoOutput(videoWidget);
    		videoWidget->setGeometry(getSettingI(MSTR_APP_X).toInt(),					
    			getSettingI(MSTR_APP_Y).toInt(),										
    			getSettingI(MSTR_APP_WIDTH).toInt(),									
    			getSettingI(MSTR_APP_HEIGHT).toInt());		
    		videoWidget->show();
    		player->play();
    

  • Lifetime Qt Champion

    Hi,

    You should add:

    • Qt version
    • OS version
    • Video file specification


  • @SGaist Oh my dev machine is :
    Windows 10
    QT 5.12.2
    Visual Studio 2017
    There are 2 video files, both of MP4 type. (I've tried AVI as well)
    All codecs installed, videos play fine, it is just on the loop restart there is a black screen for 0.5 second

    I've executed the deployed app on a Windows 7 machine with the same outcome.



  • @celica Hi there, any one ever experience this issue & overcome before


Log in to reply