QTコードからMeego / Nokia N9でビデオスイートを起動する方法

StackOverflow https://stackoverflow.com/questions/9504413

  •  14-11-2019
  •  | 
  •  

質問

私のアプリケーションからNokia自身のビデオプレーヤーを立ち上げることに問題があります。

私の最初の試み呼び出し

Qt.openUrlExternally(url)
.

QMLから、毎回ブラウザを開き、ビデオスイート(ネイティブプレーヤー)の代わりにそれを使用したことを除いて、それがちょうど微妙なことをしているようでした。

次は私がこのような新しいプロセスを始めるCutetube-applachを試してみました:

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);
.

それがプレイヤーを呼び出して閉じることを必要としたことを除いて、それが閉じられることを除いて、それ以外の場合は何もしませんでした。

私の3回目の試みは、QDBUS経由でビデオスイートを起動しましたが、それは良く機能しませんでした:

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";
}
.

これに関する問題は、ビデオスイートが上げて実行される必要があることです - AutoStartServiceパラメータも役に立ちませんでした。ビデオスイートがすでに実行されていない場合、コールはそれを細かく開くが、AlAs、ビデオは再生を開始します。

最終的に私はまた VideoSuiteInterface 。ただし、プログラムをコンパイルしても難しいようです。私が最終的にすべての関連ライブラリをコンパイルしてリンクすることができたとき、結果は上記のオプション3とは異なりませんでした。

では、現在の状態に関係なくビデオの再生を開始するように、ビデオ再生を開始するように、ビデオ再生を開始するようにVideoSuiteIterfaceを使用する方法がありますか?

役に立ちましたか?

解決

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top