Qt 코드에서 Meego / Nokia N9에서 비디오 스위트를 시작하는 방법은 무엇입니까?

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

  •  14-11-2019
  •  | 
  •  

문제

Nokia의 비디오 플레이어를 출시하는 데 문제가 있으며, 방금 해결할 수없는 것처럼 보이지 않는 것으로 보입니다.

내 첫 번째 시도가 포함 된

Qt.openUrlExternally(url)
. QML에서

그리고 그 때마다 브라우저를 열고 비디오 스위트 (원시 플레이어) 대신 브라우저를 열었습니다.

다음에 cuteTube - 이처럼 새로운 프로세스를 시작하는 captochoach를 시도했습니다.

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

플레이어 -> 시작에 전화를 걸어 닫아야 할 비디오 스위트가 필요하다는 것을 제외하고는, 그렇지 않으면 아무것도하지 않았습니다.

내 세 번째 시도는 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 매개 변수가 도움이되지 않았습니다. video-suite가 이미 실행되지 않으면 통화가 괜찮아 왔지만 Alas는 비디오가 재생되기 시작하지 않습니다.

결국 videosuiteInterface 그러나 프로그램을 컴파일하는 것처럼 보이는 것처럼 보였습니다. 결국 모든 관련 라이브러리를 컴파일하고 연결할 수있게되었을 때 결과는 위의 옵션 3과 다르지 않았습니다.

그래서 videosuiteInterface를 직접 또는 DBUS를 통해 사용하여 응용 프로그램의 현재 상태에 관계없이 비디오 재생을 시작할 수있는 방법이 있습니까?

도움이 되었습니까?

해결책

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