2020-04-22 06:36:41 +00:00
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
|
#include "widget.h"
|
|
|
|
|
#include "ui_widget.h"
|
|
|
|
|
|
2020-08-27 07:38:19 +00:00
|
|
|
|
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
|
2020-04-22 06:36:41 +00:00
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
2023-03-26 09:38:06 +00:00
|
|
|
|
//本示例支持的是rtsp视频流(其他的一概不支持/没有做音视频同步)
|
2020-04-22 06:36:41 +00:00
|
|
|
|
QStringList urls;
|
2023-03-26 09:38:06 +00:00
|
|
|
|
urls << "http://vfx.mtime.cn/Video/2021/11/16/mp4/211116131456748178.mp4";
|
2020-04-22 06:36:41 +00:00
|
|
|
|
urls << "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
|
2021-11-25 11:59:38 +00:00
|
|
|
|
urls << "rtsp://admin:Admin123456@192.168.0.15:554/media/video1";
|
2020-04-22 06:36:41 +00:00
|
|
|
|
ui->cboxUrl->addItems(urls);
|
2021-11-17 07:33:19 +00:00
|
|
|
|
ui->cboxUrl->setCurrentIndex(0);
|
2020-04-22 06:36:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget::~Widget()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Widget::on_btnOpen_clicked()
|
|
|
|
|
{
|
|
|
|
|
if (ui->btnOpen->text() == "打开") {
|
|
|
|
|
ui->btnOpen->setText("关闭");
|
|
|
|
|
QString url = ui->cboxUrl->currentText().trimmed();
|
2020-08-27 07:38:19 +00:00
|
|
|
|
ui->playWidget->setUrl(url);
|
|
|
|
|
ui->playWidget->open();
|
2020-04-22 06:36:41 +00:00
|
|
|
|
} else {
|
|
|
|
|
ui->btnOpen->setText("打开");
|
2020-08-27 07:38:19 +00:00
|
|
|
|
ui->playWidget->close();
|
2020-04-22 06:36:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|