Reputation: 99
I want to deploy one YouTube application in Android. But it only works on my computer, and it does not work on Android. It does not load any video. The problem is only with the QWebView. I used a code similar to this: http://doc.qt.io/archives/qt-5.5/qtwebkitexamples-webkitqml-youtubeview-example.html
Upvotes: 3
Views: 3602
Reputation: 4602
Referring to Qt Documentations:
Qt WebEngine is not available on mobile platforms
While
Qt WebView is actually useful for mobile platforms! .. as stated by Qt Here
You can use QwebView
with Android
, This should be possible with Qt5.x
, as follow:
Configure project for Android kit and add QT += webview
to your .pro
file.
In main.cpp
, it's important to call QtWebView::initialize()
right after creating the QGuiApplication
:
#include <QtWebView>
QGuiApplication app(argc, argv);
QtWebView::initialize();
Now ready to use at qml side:
import QtWebView 1.1
WebView {
id: webView
anchors.fill: parent
url: "http://some/url/"
onLoadingChanged: {
if (loadRequest.errorString)
console.error(loadRequest.errorString);
}
}
Check Qt MiniBrowser Exmaple for QwebView with Android
.
Upvotes: 2
Reputation: 828
if you are using Qt5. You should use WebEngineView, QWebView will not work on android.
import QtQuick 2.0
import QtWebEngine 1.4
Item{
id:root
height: 500
width: 500
Rectangle{
anchors.fill: parent
color: "black"
WebEngineView{
id : webEnginView
anchors.fill: parent
url : https://www.google.com
}
}
}
Upvotes: -1