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