Forums

OverviewFelgo 2 Support (Qt 5) › MediaPlayer can't play audio file

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21693

    sAMA SAMA

    I’m trying to build a music player and have this button to play a sound:

    AppButton{
                    width: 150
                    height: 50
                    text: "Click Me!";
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.verticalCenter: parent.verticalCenter
    
                    MediaPlayer {
                        id: playMusic
                        source: "E:/Breaeze/SampleAudio_0.mp3" //audio file location
                    }
                    MouseArea {
                        id: playArea
                        anchors.fill: parent
                        onPressed:  { playMusic.play() }
                    }
                }

    My audio can’t be played when I use a directory on my local PC and gives me this error:

    DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80070002 ()

    But when I use this URL instead :

    https://sample-videos.com/audio/mp3/crowd-cheering.mp3

    it works why?

    #21708

    Alex
    Felgo Team

    Hi,

    what operating system are you using? I just tried your example on Windows 10 and it works for me.

    Note that for local files, you should also add

    file:///

    as prefix, like “file:///E:/Breaeze/SampleAudio_0.mp3”.

    Please also make sure that your path is correct. If you start typing with “file:///” Qt Creator will also allow you to navigate to your file while typing.

    You can also Google for e.g. “Qt DirectShowPlayerService::doSetUrlSource: Unresolved error” to find more help.

    Cheers,
    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support