Discussion Board

Results 1 to 3 of 3
  1. #1
    Nokia Developer Champion xhsoldier's Avatar
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190
    defaultServiceProvider::requestService(): no service found for - "com.nokia.qt.mediaplayer"

    I am using the QMediaPlayer to play a mp3 file, but get this error. How to resolve this?

  2. #2
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

  3. #3
    Nokia Developer Champion xhsoldier's Avatar
    Join Date
    May 2006
    Location
    Beijing,China
    Posts
    1,190
    It says that it will work on the real device, not on simulator. but why on real device, my still does not work. Here is my code:
    Does play sound need any capability?

    I debuged, and get QMediaPlayer::InvalidMedia, why? Is my path not correct or the mp3 file is not correct?

    Sound::Sound(QWidget *parent) :
    QWidget(parent)
    {
    playSound = new QPushButton(this);
    playSound->setText("Play Sound");
    playSound->setFixedSize(QSize(200,100));
    playSound->setGeometry(80,200, 200,100);

    mPlayer = new QMediaPlayer(this);
    QString mypath("C:\\QT_workspace\\second\\3days.mp3"); //already put this file in the C drive on the phone
    // QString mypath(":\\3days.mp3");
    QUrl mySoundUrl = QUrl::fromLocalFile(mypath.toAscii());
    QMediaResource myResource(mySoundUrl, "audio");
    QMediaContent mymedia(myResource);
    mPlayer->setMedia(mymedia);
    mPlayer->setVolume(80);

    QObject::connect(mPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
    QObject::connect(mPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(stateChanged(QMediaPlayer::State)));
    QObject::connect(playSound,SIGNAL(clicked()),this,SLOT(on_playbutton_clicked()));


    // Symbian specific code
    #ifdef Q_OS_SYMBIAN
    #endif

    }

    void Sound:n_playbutton_clicked()
    {
    mPlayer->play();
    }

    void Sound::statusChanged(QMediaPlayer::MediaStatus status) {
    switch(status) {
    case QMediaPlayer::LoadedMedia:
    mPlayer->play();
    break;

    case QMediaPlayer::LoadingMedia:
    mPlayer->play();

    default:
    break;
    }
    }

    void Sound::stateChanged(QMediaPlayer::State state) {
    switch(state) {
    case QMediaPlayer::PlayingState:
    qDebug() << "now playing";
    break;

    case QMediaPlayer::StoppedState:
    qDebug() << "now stopped";
    break;

    case QMediaPlayer::PausedState:
    qDebug() << "now paused";
    break;
    }
    }
    Last edited by xhsoldier; 2010-11-29 at 05:30.

Similar Threads

  1. qmediaplayer no service found for - "com.nokia.qt.mediaplayer"
    By oruccim in forum [Archived] Qt Mobility Project
    Replies: 7
    Last Post: 2012-07-06, 08:46
  2. Replies: 3
    Last Post: 2010-06-30, 01:17
  3. No Service found - Nokia Example btsppecho
    By jamesmasters1985 in forum Mobile Java Networking & Messaging & Security
    Replies: 7
    Last Post: 2009-03-26, 16:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved