Forums

OverviewFelgo 2 Support (Qt 5) › MediaPlayer

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17919

    André

    Hi,

     

    Can I use something like this in Felgo? I would like to play mp3 files from an URL

     

    Text {
    text: “Click Me!”
    font.pointSize: 24
    width: 150
    height: 50

    MediaPlayer {
    id: playMusic
    source: “http://www.sample-videos.com/audio/mp3/wave.mp3”
    }
    MouseArea {
    id: playArea
    anchors.fill: parent
    onPressed: { playMusic.play() }
    }
    }

     

     

    Thanks,

     

    André

    #17924

    Günther
    Felgo Team

    Hi Andre!

    Yes, it is possible to use MediaPlayer like that. However, on macOS the loading of your audio resource is blocked by default for unsecure HTTP connections. To make this example work, you can

    • either use a secure SSL connection with HTTPS (if your server supports it)
    • or create a custom Info.plist for macOS application configuration, which allows to specify:
            <key>NSAppTransportSecurity</key>
            <dict>
                <key>NSAllowsArbitraryLoads</key>
                <true/>
                <key>NSExceptionDomains</key>
                <dict>
                    <key>example.com</key>
                    <dict>
                        <key>NSExceptionAllowsInsecureHTTPLoads</key>
                        <true/>
                        <key>NSIncludesSubdomains</key>
                        <true/>
                    </dict>
                </dict>
            </dict>

    With this setting your application then allows Insecure Http Loads. You can specify a custom plist configuration in your *.pro configuration with e.g.

     

    QMAKE_INFO_PLIST = macx/Info.plist

     

    Please note that you have to delete your shadow build directory / previously built application to correctly rebuild the app and copy your modified plist. A simple rebuild after changing the plist will not affect your previously built bundle and you won’t see any changes.

    Best,
    Günther

    #17927

    André

    Thanks! – I got it working.

Viewing 3 posts - 1 through 3 (of 3 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