Pregunta

Estoy teniendo problemas con el lanzamiento del propio reproductor de video de Nokia desde mi aplicación que simplemente no puedo ser capaz de resolver.

Mi primer intento incluyó llamar

Qt.openUrlExternally(url)

de QML y eso pareció hacer el truco está bien, excepto que abrió el navegador cada vez y lo usó en lugar de la suite de video (jugador nativo).

Siguiente Probé CutEtTube -Apferty donde inicio nuevo proceso como este:

QStringList args;
args << url;
QProcess *player = new QProcess();
connect(player, SIGNAL(finished(int, QProcess::ExitStatus)), player, SLOT(deleteLater()));
player->start("/usr/bin/video-suite", args);

Eso funcionó, excepto que requirió que la suite de video se cierra al llamar a Player-> Iniciar, de lo contrario no hizo nada.

Mi tercer intento involucrado comenzando la suite de video a través de Qdbus, pero eso no funcionó mejor:

QList<QVariant> args;
QStringList urls;
urls << url;
args.append(urls);

QDBusMessage message = QDBusMessage::createMethodCall(
    "com.nokia.VideoSuite",
    "/",
    "com.nokia.maemo.meegotouch.VideoSuiteInterface",
    "play");

message.setArguments(args);
message.setAutoStartService(true);

QDBusConnection bus = QDBusConnection::sessionBus();

if (bus.isConnected()) {
    bus.send(message);
} else {
    qDebug() << "Error, QDBus is not connected";
}

El problema con esto es que requiere una suite de video para estar en funcionamiento, el parámetro AUTOSTARTSERVICE tampoco lo ayudó. Si la suite de video ya no funciona, la llamada lo abre bien, pero, ay, sin video comienza a jugar.

Finalmente, intenté usar también videosuiteinterface , pero incluso tener el programa compilado con él parecía ser difícil. Cuando finalmente logré compilar y vincular todas las bibliotecas relevantes, los resultados no difirieron de la opción 3 anterior.

Entonces, ¿hay una manera de usar videosuiteinterface directamente o a través de DBUS para que inicie la reproducción de video independientemente del estado actual de la aplicación?

¿Fue útil?

Solución

The solution was actually simpler than I really thought initially; the VideoSuiteInterface -approach worked after all. All it took was to use it properly. Here are the full sources should anyone want to try it themselves.

player.h:

#ifndef PLAYER_H
#define PLAYER_H
#include <QObject>
#include <maemo-meegotouch-interfaces/videosuiteinterface.h>

class Player : public QObject {
  Q_OBJECT
private:
  VideoSuiteInterface* videosuite;
public:
  Player(QObject *parent = 0);
  Q_INVOKABLE void play(QString url);
};
#endif // PLAYER_H

player.cpp:

#include "player.h"
#include <QObject>
#include <QStringList>
#include <QtDeclarative>

Player::Player(QObject *parent) : QObject(parent) {}

void Player::play(QString url) {
  QList<QVariant> args;
  QStringList urls;
  urls << url;
  args.append(urls);

  videosuite = new VideoSuiteInterface();
  videosuite->play(urls);
}

In addition you may want to connect some signals to make the UI more responsive, but basically that should do the trick.

Finally, you need to remember to add following to your .pro file and you are good to go:

CONFIG += videosuiteinterface-maemo-meegotouch
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top