I Am a beginner in Qt learning so forgive me if this question is already asked but believe me, i searched but i didn't find anything just like what I want.
So I want to play an Url video using QMediaPlayer
and QVideoWidget
, when i did try this code:
//remplir playlist
playlist->addMedia(QUrl::fromLocalFile("C:/Users/Wafae/Documents/Visual Studio 2010/Projects/maFenetre/relax-3-minutes-rainforest-animals-waterfall-and-rain-sounds.mp4"));
playlist->addMedia(QUrl::fromLocalFile("C:/Users/Wafae/Documents/Visual Studio 2010/Projects/maFenetre/3-minutes-that-will-change-your-life-beautiful-nature-relaxing-inspiring-video.mp4"));
-------------
--------------
playlist->addMedia(QUrl("https://youtu.be/6v2L2UGZJAM"));
playlist->setCurrentIndex(1);
playlist->setPlaybackMode(QMediaPlaylist::Loop);
//player code
player->setPlaylist(playlist);
player->setVideoOutput(videoWidget);
player->setVolume(100);
//positionner videowidget
videoWidget->setGeometry(100,100,500,400);
videoWidget->show();
myLayout = new QGridLayout(this);
myLayout->addWidget(videoWidget);
-------
--------
---------
player->play();
but it skip it and come back to the first local video
Can any one help me please!