-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmultimedia.cpp
55 lines (39 loc) · 1.13 KB
/
multimedia.cpp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "multimedia.h"
void Multimedia::showImg() const{
QPixmap img(img_URL);
QLabel label;
label.setPixmap(img);
label.show();
}
//QPixmap pm("path/to/your/image.jpg");
// QLabel lbl;
// lbl.setPixmap(pm);
// lbl.show();
// return app.exec();
void audio::playAudio() const {
QMediaPlayer* playeraudio = new QMediaPlayer;
playeraudio->setMedia(QUrl::fromLocalFile(audio_URL));
//player->setVolume(50);
playeraudio->play();
}
void audio::pauseAudio() const {
if (playeraudio->state() == QMediaPlayer::PlayingState)
playeraudio->QMediaPlayer::pause();
}
void audio::stopAudio() const {
playeraudio->QMediaPlayer::stop();
}
void video::playVideo() const { // with QVideoWidget
QMediaPlayer* playervideo = new QMediaPlayer;
//QVideoWidget* videoWidget = new QVideoWidget;
//playervideo->setVideoOutput(videoWidget);
playervideo->setMedia(QUrl::fromLocalFile(video_URL));
//videoWidget->show();
playervideo->play();
}
void video::pauseVideo() const {
playervideo->QMediaPlayer::pause();
}
void video::stopVideo() const {
playervideo->QMediaPlayer::stop();
}