From b5acbc37299218b90908bbaf341cf971ad957c07 Mon Sep 17 00:00:00 2001 From: Matt Ranostay Date: Wed, 6 Jun 2018 20:25:25 -0700 Subject: mediaplayer: workaround race condition with agl-service-mediaplayer service On some startups the agl-service-mediaplayer triggers an event during QML + UI load which causes it to be dropped. Delaying for 300 milliseconds seems to workaround this issue, but needs to be replaced with a proper method in the future. Bug-AGL: SPEC-1496 Change-Id: Iefd825f79b19c422a153b3d77b4d3a472c13c372 Signed-off-by: Matt Ranostay --- app/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/main.cpp b/app/main.cpp index 8fa8117..4713fdb 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -31,6 +31,8 @@ #include #include +#include + int main(int argc, char *argv[]) { QString myname = QString("MediaPlayer"); @@ -98,6 +100,9 @@ int main(int argc, char *argv[]) context->setContextProperty("mediaplayer", new Mediaplayer(bindingAddress)); context->setContextProperty("bluetooth_connection", new Bluetooth(bindingAddress)); + + usleep(300000); + engine.load(QUrl(QStringLiteral("qrc:/MediaPlayer.qml"))); QObject *root = engine.rootObjects().first(); QQuickWindow *window = qobject_cast(root); -- cgit 1.2.3-korg