diff options
Diffstat (limited to 'examples/multimedia/videographicsitem/videoplayer.h')
-rw-r--r-- | examples/multimedia/videographicsitem/videoplayer.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/multimedia/videographicsitem/videoplayer.h b/examples/multimedia/videographicsitem/videoplayer.h new file mode 100644 index 000000000..5cd4d7434 --- /dev/null +++ b/examples/multimedia/videographicsitem/videoplayer.h @@ -0,0 +1,47 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef VIDEOPLAYER_H +#define VIDEOPLAYER_H + +#include <QMediaPlayer> +#include <QWidget> + +QT_BEGIN_NAMESPACE +class QAbstractButton; +class QSlider; +class QGraphicsVideoItem; +QT_END_NAMESPACE + +class VideoPlayer : public QWidget +{ + Q_OBJECT + +public: + VideoPlayer(QWidget *parent = nullptr); + ~VideoPlayer(); + + void load(const QUrl &url); + bool isPlayerAvailable() const; + + QSize sizeHint() const override; + +public slots: + void openFile(); + void play(); + +private slots: + void mediaStateChanged(QMediaPlayer::PlaybackState state); + void positionChanged(qint64 position); + void durationChanged(qint64 duration); + void setPosition(int position); + void rotateVideo(int angle); + +private: + QMediaPlayer *m_mediaPlayer = nullptr; + QGraphicsVideoItem *m_videoItem = nullptr; + QAbstractButton *m_playButton = nullptr; + QSlider *m_positionSlider = nullptr; +}; + +#endif |