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. Ask a noob question, how is the url written?
Forum Updated to NodeBB v4.3 + New Features

Ask a noob question, how is the url written?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 3 Posters 380 Views
  • 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.
  • H Offline
    H Offline
    hilod
    wrote on last edited by
    #1
    import QtQuick 2.15
    import QtQuick.Window 2.15
    import QtQuick.Controls
    import QtMultimedia
    
    ApplicationWindow{
        id:window
        visible: true
    
    
        MediaPlayer {
               id: player
               source: "file:///C:/Users/user/Downloads/1.01 HARVESTELLA Main Theme.flac"
               audioOutput: AudioOutput {}
           }
    
           Component.onCompleted: {
               player.play()
           }
    }
    
    

    This format is the answer after I have searched, but he does not work. I also tried "\" instead of "/" and "file://" instead of "file:///".

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by JoeCFD
      #2

      Try \ instead of /.
      / is for Linux and Unix. Although QML should be able to handle it.
      "file:///C:\Users\user\Downloads\1.01 HARVESTELLA Main Theme.flac"
      I guess Windows did this on purpose and was not nice.

      TomZT 1 Reply Last reply
      0
      • H Offline
        H Offline
        hilod
        wrote on last edited by
        #3

        2022-12-17 00 20 24.png

        1 Reply Last reply
        0
        • JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #4

          are you using Qt5 or Qt6? You have mixed import package versions. Windows guys may help you out. I would try to use QUrl class to define the url and then pass it to source. That would solve your problem.

          1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            Try \ instead of /.
            / is for Linux and Unix. Although QML should be able to handle it.
            "file:///C:\Users\user\Downloads\1.01 HARVESTELLA Main Theme.flac"
            I guess Windows did this on purpose and was not nice.

            TomZT Offline
            TomZT Offline
            TomZ
            wrote on last edited by
            #5

            @JoeCFD said in Ask a noob question, how is the url written?:

            Try \ instead of /.

            In Qt you can always use forward slashes for paths.

            1 Reply Last reply
            1
            • H Offline
              H Offline
              hilod
              wrote on last edited by
              #6

              2022-12-17 00 20 24.png

              I also searched and others seem to use ffmpeg to decode to wav.

              1 Reply Last reply
              0
              • JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #7

                wav file can be played back in Windows Media Player if the appropriate codecs are installed on the computer. The most common audio codecs that are used in . wav files include Microsoft Adaptive Differential Pulse Code Modulation (MS ADPCM) and uncompressed Pulse Code Modulation (PCM).

                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