aboutsummaryrefslogtreecommitdiff
path: root/src/mediaplayer.hpp
blob: 406a0e0a81a9fd4924528c71317e9a66cbf7e552 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef MEDIAPLAYER_HPP
#define MEDIAPLAYER_HPP

#include <QWidget>
#include <QBuffer>
#include <QVideoWidget>
#include <QMediaPlayer>

namespace Ui {
class MediaPlayer;
}

class MediaPlayer : public QWidget
{
    Q_OBJECT

public:
    explicit MediaPlayer(QWidget *parent = nullptr);
    ~MediaPlayer();

    void setMedia(QByteArray const & data, QUrl const & ref_url, QString const & mime);

    void stopPlaying();

private slots:
    void on_playpause_button_clicked();

    void on_mute_button_clicked(bool checked);

    void on_media_positionChanged(qint64 pos);

    void on_media_playbackChanged(QMediaPlayer::State);

private:
    Ui::MediaPlayer *ui;
    QBuffer media_stream;
    QString mime;
    QMediaPlayer player;
};

#endif // MEDIAPLAYER_HPP