Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED]QML+QtMultimediaKit to play audio on n900
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QML+QtMultimediaKit to play audio on n900

Scheduled Pinned Locked Moved QML and Qt Quick
14 Posts 3 Posters 7.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shullw
    wrote on last edited by
    #1

    I have been trying to get a project going to play audio files through my n900 based on qml. It took me a good long time to get to where I am at, and currently I am at my wits ends. Here is a rundown of what I have done and what I am using. I am using the Qt SDK 1.1 Technical Preview. It took me a while but I learned that you have to enable the Mobility in the .pro file by doing this.

    CONFIG += mobility
    MOBILITY += multimedia

    After that I learned that the libs on my phone are obviously out of date. So I did an apt-get install libqtm-11-* so that I could get the 1.1 QtMobility libs on my n900 per this post - http://developer.qt.nokia.com/forums/viewthread/2983 As stated there I went in and put

    CONFIG += mobility11
    MOBILITY += multimedia

    As long as I don't have the "11" I can compile in the Simulator. It does give me the known error about connecting to .com.nokia and I can see the rectangle and the text. I build and install on the n900 and I get a blank screen. I have read pages and pages of docs on the qml audio tags and such and I have done what I think is correct. Please help me if you can. Here is my qml code as well.
    @
    import Qt 4.7
    import QtMultimediaKit 1.1

    Item {
    id: whole
    Rectangle {
    width: 360
    height: 360
    Text {
    text: "Click Me...And Listen?"
    anchors.centerIn: parent
    }
    Audio {
    id: playMusic
    source: "example.mp3"
    }
    MouseArea {
    id: playArea
    anchors.fill: parent
    onPressed: { playMusic.play() }
    }
    }
    }
    @
    Am I missing some #includes that I need in the .cpp file? I really don't know what to do. Days of this have yielded no results. I thank you all in advance for reading this and especially to anyone who answers. Have a nice day.

    A QML Purest Point of View!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jkosonen
      wrote on last edited by
      #2

      Anyone, I'm also interested to know how to play audio with QML?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shullw
        wrote on last edited by
        #3

        Since someone actually replied, I will detail what I had to do to get this working.

        1. You will need root access to your n900. rootsh is the program for that. In terminal now do the following
          sudo gainroot
          apt-get install libqtm-11

        That's it for the libraries. There are posts out there that say to move stuff. Those are outdated. The newer versions install in the correct directories.

        2.I had to remove the Item "parent" in my code. The n900 doesn't like an undefined width and height parent. Now since you should have
        @
        viewer.showExpanded();
        @
        in your .cpp what you actually define it won't matter because this will set it to the size of the phone.

        1. To make sure you get to the libraries you need to add this to your .cpp file
          @
          #include <QtDeclarative>
          @
          and inside your viewer loader add
          @
          viewer.engine()->addImportPath(QString("/opt/qtm11/imports"));
          @
        2. Now on to your .pro file. One quick change here lets you make the code for Symbian(as I have read, because I don't have a Symbian phone to test my app on I can only relay what I have read, man I want one though to see if it works) you need to add this.
          @
          maemo5 {
          CONFIG += mobility11
          } else {
          CONFIG += mobility
          }
          MOBILITY += multimedia
          @
        3. Now at the start of your .qml file just put
          @
          import Qt 4.7
          import QtMultimediaKit 1.1
          @
          and you are dialed. Have fun! I know I am now that I sorted a million posts out and got this working. Hopefully I can save some other starting folks some time.

        A QML Purest Point of View!

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jkosonen
          wrote on last edited by
          #4

          Hey, thanks!!

          I'll try that out, and report what's happening with N8 also :)

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jkosonen
            wrote on last edited by
            #5

            What type is that viewer? I can't do like that with
            @
            QDeclarativeView view;
            view.engine()->addImportPath(QString("/opt/qtm11/imports"));@

            it says error: invalid use of incomplete type 'struct QDeclarativeEngine'

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shullw
              wrote on last edited by
              #6

              Well that was to point to the libqtm-11 on n900. If you are getting that error on the N8 it might be possible to do the same maemo5{ view.engine()->addImportPath(QString("/opt/qtm11/imports")); }
              I don't know if that will work or not.

              A QML Purest Point of View!

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jkosonen
                wrote on last edited by
                #7

                I made that installation to my n900, but that's build error, not device error?
                and QDeclarative view doesn't have showExpanded ?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  shullw
                  wrote on last edited by
                  #8

                  Just checking to make sure you have the #include <QtDeclarative> at the top of the .cpp file. If not only have one more idea.

                  A QML Purest Point of View!

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jkosonen
                    wrote on last edited by
                    #9

                    Yeah, i missed some include, but now it's saying .qml:3:1: module "QtMultimediaKit" is not installed.. so the apt-get install didn't install all the needed files then :/

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      shullw
                      wrote on last edited by
                      #10

                      It is saying that on the n900 or is it saying that when you build in QtCreator?

                      A QML Purest Point of View!

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jkosonen
                        wrote on last edited by
                        #11

                        It's saying that in the QtCreator application output window, when it is trying to launch the program in the N900

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          shullw
                          wrote on last edited by
                          #12

                          Try building it in the simulator. If it gives the same error try adding this to your PATH on the computer you have QtCreator installed. C:\QtSDK\Simulator\QtMobility\mingw\lib It is almost like it isn't seeing the libraries in the SDK to build it. If that doesn't work you might have to install QtMobility on your machine outside of the SDK. I had done that but didn't think that is what made the difference. I guess I was totally wrong. If you have to do that google the source code for QtMobility 1.1 and download the source and follow the directions here.

                          http://qt-mobility.blogspot.com/2010/01/installing-qt-mobility-on-windows-7.html

                          I have Vista and it is running fine. It is a very simple process so don't feel overwhelmed.

                          A QML Purest Point of View!

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            srav219
                            wrote on last edited by
                            #13

                            Hi,
                            I am facing similar issue “module “QtMultimediaKit” is not installed “ on Centos Linux. I have my libs ,imports and plugins in /usr/local/lib on my embedded target


                            I have the following env variables set
                            export QT_PLUGIN_PATH=”/usr/local/lib/plugins”
                            export QML_IMPORT_PATH=”/usr/local/lib/imports”
                            In Imports Folder, i have the following
                            ls /usr/local/lib/imports
                            QtMultimediaKit
                            ls /usr/local/lib/imports/QtMultimediaKit/
                            libdeclarative_multimedia.so qmldir
                            ls /usr/local/lib/plugins/
                            accessible imageformats playlistformats webkit
                            bearer kbddrivers qmltooling
                            gfxdrivers mediaservice script
                            iconengines mousedrivers sqldrivers


                            I tried with the following qml


                            import Qt 4.7 import QtMultimediaKit 1.1 Rectangle { id: page width: 300; height:200 color: “lightgray” Text { id: helloText text: “Hello world!” y: 30 anchors.horizontalCenter: page.horizontalCenter font.pointSize: 10; font.bold: true } Audio { id: playMusic source: “audio.wav” } MouseArea { id: playArea anchors.fill: parent onPressed: { playMusic.play() } } }


                            In the PRO file , I have the following
                            QT += declarative multimedia
                            +CONFIG += mobility
                            +MOBILITY = multimedia


                            Inspite all these changes I am seeing the issue “module “QtMultimediaKit” is not installed”.
                            QT – v4.7.4
                            Mobility – v1.2
                            Can Anyone help me what has gone wrong ?

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              shullw
                              wrote on last edited by
                              #14

                              If you have Mobility 1.2 installed then it is safe to say that you are declaring the wrong version of QtMultidemiaKit. Try

                              @import QtMultimediaKit 1.2@

                              Sometimes it is just the version. Hope that helps.

                              A QML Purest Point of View!

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved