Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMediaPlayer setMedia with http url on Mac

QMediaPlayer setMedia with http url on Mac

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 2 Posters 3.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.
  • C Offline
    C Offline
    caelum
    wrote on last edited by
    #1

    i got an error when i invoked

     player->setMedia(QUrl(mp3Url));
    

    error:

    2016-01-03 20:51:51.026 myPlayer[2894:385220] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome
      The error says whats wrong.
      for a temp solution, please see
      http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http

      C 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi and welcome
        The error says whats wrong.
        for a temp solution, please see
        http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http

        C Offline
        C Offline
        caelum
        wrote on last edited by
        #3

        @mrjj how to set the NSAllowsArbitraryLoads key to YES ??

        mrjjM 1 Reply Last reply
        0
        • C caelum

          @mrjj how to set the NSAllowsArbitraryLoads key to YES ??

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @caelum
          Can u click the arrow up/down to change it ?
          Its it locked or something?
          Also the other post
          http://stackoverflow.com/questions/31216758/how-can-i-add-nsapptransportsecurity-to-my-info-plist-file/31629980#31629980
          talks about adding it.

          C 1 Reply Last reply
          0
          • mrjjM mrjj

            @caelum
            Can u click the arrow up/down to change it ?
            Its it locked or something?
            Also the other post
            http://stackoverflow.com/questions/31216758/how-can-i-add-nsapptransportsecurity-to-my-info-plist-file/31629980#31629980
            talks about adding it.

            C Offline
            C Offline
            caelum
            wrote on last edited by
            #5

            @mrjj i built the project in qtcreator , not in xcode

            mrjjM 1 Reply Last reply
            0
            • C caelum

              @mrjj i built the project in qtcreator , not in xcode

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @caelum
              ok, so you need to generate the file yourself it seems.
              http://stackoverflow.com/questions/19293387/qt-generate-info-plist-file

              But if u are just trying to play local mp3 file then you can just do
              player->setMedia(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3"));

              C 1 Reply Last reply
              0
              • mrjjM mrjj

                @caelum
                ok, so you need to generate the file yourself it seems.
                http://stackoverflow.com/questions/19293387/qt-generate-info-plist-file

                But if u are just trying to play local mp3 file then you can just do
                player->setMedia(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3"));

                C Offline
                C Offline
                caelum
                wrote on last edited by
                #7

                @mrjj thank you , can u show me the detail how to generate the info.plist file and set NSAllowsArbitraryLoads key to YES? i am a newb of qt :)...

                mrjjM 1 Reply Last reply
                0
                • C caelum

                  @mrjj thank you , can u show me the detail how to generate the info.plist file and set NSAllowsArbitraryLoads key to YES? i am a newb of qt :)...

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #8

                  @caelum
                  Hi, im afraid im even bigger noob with mac OS
                  it seems that you must add
                  QMAKE_INFO_PLIST += $${TARGET}/data/default.plist
                  QMAKE_POST_LINK += sed -i -e "s/@VERSION@/$$VERSION/g" "./$${TARGET}.app/Contents/Info.plist";
                  to your pro file.
                  then it will create one in the Contents folder

                  Reading this, it already sounds like Creator will make a default one.
                  http://wiki.qt.io/OS_X_application_without_menu_bar

                  So in any case, you should open this file for editing in editor.
                  then add

                  <key>NSAppTransportSecurity</key>  
                    <dict>  
                            <key>NSAllowsArbitraryLoads</key><true/>  
                    </dict>  
                  

                  just before the last
                  </plist>

                  Also just to be clear. It makes app less secure as I understand it.

                  C 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @caelum
                    Hi, im afraid im even bigger noob with mac OS
                    it seems that you must add
                    QMAKE_INFO_PLIST += $${TARGET}/data/default.plist
                    QMAKE_POST_LINK += sed -i -e "s/@VERSION@/$$VERSION/g" "./$${TARGET}.app/Contents/Info.plist";
                    to your pro file.
                    then it will create one in the Contents folder

                    Reading this, it already sounds like Creator will make a default one.
                    http://wiki.qt.io/OS_X_application_without_menu_bar

                    So in any case, you should open this file for editing in editor.
                    then add

                    <key>NSAppTransportSecurity</key>  
                      <dict>  
                              <key>NSAllowsArbitraryLoads</key><true/>  
                      </dict>  
                    

                    just before the last
                    </plist>

                    Also just to be clear. It makes app less secure as I understand it.

                    C Offline
                    C Offline
                    caelum
                    wrote on last edited by
                    #9

                    @mrjj thank you very much, it works for me :)

                    mrjjM 1 Reply Last reply
                    1
                    • C caelum

                      @mrjj thank you very much, it works for me :)

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @caelum
                      Oh that is good news :)

                      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