Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to play video backwards in qt using vlc-qt libvlc
Forum Updated to NodeBB v4.3 + New Features

How to play video backwards in qt using vlc-qt libvlc

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 296 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    devillIsHeree
    wrote on last edited by
    #1

    I am developing a media player using vlc-qt , Actually I want a button which will play do the fast backward operation. I don't have the problem with the fast forward operation but not able to implement the fast backward operation, Is there any function there in vlc-qt which will play the video backwards. Here are the buttons code which I am using for fast forward and fast backward operation

    void expPlayer::on_pushButton_2_clicked()
    {
        m_player->setPlaybackRate(m_player->playbackRate()+1);
    }
    
    void expPlayer::on_pushButton_3_clicked()
    {
        //It should play the video backward with more playback rate.
    }
    

    Here is my full code
    my header file

    #ifndef EXPPLAYER_H
    #define EXPPLAYER_H
    
    #include <QMainWindow>
    #include "VLCQtCore/Instance.h"
    #include "VLCQtCore/MediaPlayer.h"
    #include "VLCQtCore/Media.h"
    #include "VLCQtCore/Common.h"
    #include "VLCQtCore/Config.h"
    #include "QPushButton"
    #include "QtMultimedia/QMediaPlaylist"
    #include "VLCQtWidgets/WidgetVideo.h"
    #include "VLCQtWidgets/WidgetSeekProgress.h"
    #include "QSlider"
    #include "QFileDialog"
    #include "QInputDialog"
    #include "QLabel"
    #include "QListView"
    #include "QBoxLayout"
    #include "VLCQtWidgets/WidgetSeek.h"
    QT_BEGIN_NAMESPACE
    namespace Ui { class expPlayer; }
    QT_END_NAMESPACE
    
    class expPlayer : public QMainWindow
    {
        Q_OBJECT
    
    public:
        expPlayer(QWidget *parent = nullptr);
        ~expPlayer();
    
    private slots:
        void on_pushButton_clicked();
    
        void on_pushButton_2_clicked();
        
        void on_pushButton_3_clicked();
        
    private:
        Ui::expPlayer *ui;
    
        VlcInstance *m_instance;
        VlcMedia *m_media;
        VlcMediaPlayer *m_player;
        VlcWidgetSeekProgress *m_progressBar;
    };
    #endif // EXPPLAYER_H
    
    
    

    My cpp file

    #include "expplayer.h"
    #include "ui_expplayer.h"
    
    expPlayer::expPlayer(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::expPlayer)
    {
        ui->setupUi(this);
        m_instance = new VlcInstance(VlcCommon::args(), this);
        m_player = new VlcMediaPlayer(m_instance);
    
        m_player->setVideoWidget(ui->m_video);
        ui->m_video->setMediaPlayer(m_player);
        m_progressBar=new VlcWidgetSeekProgress(this);
        m_progressBar->setMediaPlayer(m_player);
        ui->m_video->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
        ui->m_video->show();
    
        m_media = new VlcMedia("http://www.youtube.com/watch?v=Btv7G0BV45g",m_instance);
        m_player->open(m_media);
        qDebug()<<"m_player->video():"<<m_player->video();
        m_player->play();
    
        m_progressBar->resize(ui->m_video->width(),30);
        m_progressBar->move(ui->m_video->x(),ui->m_video->y()+ui->m_video->height()+20);
        m_progressBar->show();
    
    }
    
    expPlayer::~expPlayer()
    {
        delete ui;
    }
    
    
    void expPlayer::on_pushButton_clicked()
    {
    
    
    
    }
    
    void expPlayer::on_pushButton_2_clicked()
    {
        m_player->setPlaybackRate(m_player->playbackRate()+1);
    }
    
    void expPlayer::on_pushButton_3_clicked()
    {
        //It should play the video backward with more playback rate.
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved