summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@theqtcompany.com>2015-12-14 14:54:39 +0100
committerAlexandru Croitor <alexandru.croitor@theqtcompany.com>2015-12-15 17:03:10 +0000
commit26aa7e314e58ea7be375fc767f6806127e50338d (patch)
treef1575597351effd890379420fca63f04100d8e87 /src/webengine/api/qquickwebengineview.cpp
parent6414f93b39c57b2718a622430f7e0329b3512c8b (diff)
Add support for checking if audio is played in a page.
Add support for checking if audio is played in a page, as well as the ability to (un)mute the audio. Modify demobrowser example to show (muted) in the tab title, if the tab is muted, or (audible) if there is audio playing in the tab. Fix HTML5 audio/video (un)mute to also work. Change-Id: I7213645e67be2f9da1c5f96cdf6c7eef5341ae4b Task-number: QTBUG-48788 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index b9fa3d605..7b0ed0a33 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -392,6 +392,12 @@ void QQuickWebEngineViewPrivate::didUpdateTargetURL(const QUrl &hoveredUrl)
Q_EMIT q->linkHovered(hoveredUrl);
}
+void QQuickWebEngineViewPrivate::wasRecentlyAudibleChanged(bool wasRecentlyAudible)
+{
+ Q_Q(QQuickWebEngineView);
+ Q_EMIT q->wasRecentlyAudibleChanged(wasRecentlyAudible);
+}
+
QRectF QQuickWebEngineViewPrivate::viewportRect() const
{
Q_Q(const QQuickWebEngineView);
@@ -1084,6 +1090,33 @@ void QQuickWebEngineView::setBackgroundColor(const QColor &color)
emit backgroundColorChanged();
}
+/*!
+ \property QQuickWebEngineView::audioMuted
+ \brief the state of whether the current page audio is muted.
+ \since 5.7
+
+ The default value is false.
+*/
+bool QQuickWebEngineView::isAudioMuted() const {
+ const Q_D(QQuickWebEngineView);
+ return d->adapter->isAudioMuted();
+
+}
+void QQuickWebEngineView::setAudioMuted(bool muted) {
+ Q_D(QQuickWebEngineView);
+ bool _isAudioMuted = isAudioMuted();
+ d->adapter->setAudioMuted(muted);
+ if (_isAudioMuted != muted) {
+ Q_EMIT audioMutedChanged(muted);
+ }
+}
+
+bool QQuickWebEngineView::wasRecentlyAudible()
+{
+ Q_D(QQuickWebEngineView);
+ return d->adapter->wasRecentlyAudible();
+}
+
bool QQuickWebEngineView::isFullScreen() const
{
Q_D(const QQuickWebEngineView);