diff options
Diffstat (limited to 'examples/multimedia/videowidget/videoplayer.h')
-rw-r--r-- | examples/multimedia/videowidget/videoplayer.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/multimedia/videowidget/videoplayer.h b/examples/multimedia/videowidget/videoplayer.h new file mode 100644 index 000000000..3657a04de --- /dev/null +++ b/examples/multimedia/videowidget/videoplayer.h @@ -0,0 +1,44 @@ +// 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 QLabel; +class QUrl; +QT_END_NAMESPACE + +class VideoPlayer : public QWidget +{ + Q_OBJECT +public: + VideoPlayer(QWidget *parent = nullptr); + ~VideoPlayer(); + + void setUrl(const QUrl &url); + +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 handleError(); + +private: + QMediaPlayer *m_mediaPlayer; + QAbstractButton *m_playButton; + QSlider *m_positionSlider; + QLabel *m_errorLabel; +}; + +#endif |