qt_demoe/video/plaympv/widget.cpp

35 lines
979 B
C++
Raw Normal View History

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);
QStringList urls;
2021-11-17 07:33:19 +00:00
urls << "https://hls01open.ys7.com/openlive/6e0b2be040a943489ef0b9bb344b96b8.hd.m3u8";
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 << "http://vfx.mtime.cn/Video/2019/02/04/mp4/190204084208765161.mp4";
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
}
}