I have some idea how to solve this but I am stuck with two problems now.
In QMediaPlayer there is slot
void QMediaPlayer
::setMedia(const QMediaContent
& media,
QIODevice * stream
= 0)
void QMediaPlayer::setMedia(const QMediaContent & media, QIODevice * stream = 0)
To copy to clipboard, switch view to plain text mode
So I can implement my own QIODevice to read encrypted video files.
I found this article: http://daniel-albuschat.blogspot.com...-qtwebkit.html how to create own widget in QWebView, so I created my own class videowidget:
#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H
#include <QtMultimediaWidgets/QVideoWidget>
class VideoWidget : public QVideoWidget
{
Q_OBJECT
public:
explicit VideoWidget
(QWidget *parent
= 0);
VideoWidget(const VideoWidget &other);
signals:
public slots:
};
Q_DECLARE_METATYPE(VideoWidget)
#endif // VIDEOWIDGET_H
#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H
#include <QtMultimediaWidgets/QVideoWidget>
class VideoWidget : public QVideoWidget
{
Q_OBJECT
public:
explicit VideoWidget(QWidget *parent = 0);
VideoWidget(const VideoWidget &other);
signals:
public slots:
};
Q_DECLARE_METATYPE(VideoWidget)
#endif // VIDEOWIDGET_H
To copy to clipboard, switch view to plain text mode
#include "VideoWidget.h"
VideoWidget
::VideoWidget(QWidget *parent
) : QVideoWidget(parent)
{
.........
}
VideoWidget::VideoWidget(const VideoWidget &other)
{
}
#include "VideoWidget.h"
VideoWidget::VideoWidget(QWidget *parent) :
QVideoWidget(parent)
{
.........
}
VideoWidget::VideoWidget(const VideoWidget &other)
{
}
To copy to clipboard, switch view to plain text mode
and my main:
int main(int argc, char *argv[])
{
qRegisterMetaType<VideoWidget>();
Creator w;
w.show();
return a.exec();
}
int main(int argc, char *argv[])
{
qRegisterMetaType<VideoWidget>();
QApplication a(argc, argv);
Creator w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
and html file:
<!DOCTYPE html>
<html>
<head> <meta
charset="utf-8"></head>
<body>
<object type="application/x-qt-plugin" classid="VideoWidget" name="VideoWidget" height=300 width=500></object>
</body>
</html>
<!DOCTYPE html>
<html>
<head> <meta
charset="utf-8"></head>
<body>
<object type="application/x-qt-plugin" classid="VideoWidget" name="VideoWidget" height=300 width=500></object>
</body>
</html>
To copy to clipboard, switch view to plain text mode
Now, when my WebPage::createPlugin is called (my webpage class looks the same as in example) I am getting error "QFormBuilder was unable to create a widget of the class 'VideoWidget'." and instance of my class VideoWidget is not created. Any idea how to make this work?
The second problem is that QVideoWidget doesn't have such controls to play, pause as in webkit player, is there a easy way to create that controls like in <video> webkit player?
thanks in advance
Bookmarks