Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Audio file is not available on Ubuntu mate



  • [0_1552374208953_Alarm01.wav](Uploading 100%)

    Above audio file is from windows media.

    This file is available on Windows but, on ubuntu mate (arm64), this is not available on Qt QMediaPlayer api.

    It display [Warning: "Could not get/set settings from/on resource."]

    Is there anybody knows reson?

    Platform : Arm64 (Odroid C2)
    OS : Ubuntu mate 18.04
    Qt : 5.9.5


  • Moderators

    Please share the code you're using to access/ play the file.



  • Here is parts of my code to play wave file.

    MediaPlayer
    {
    id: soundPlayer

        loops: 0
    
        property bool isReadyToPlay: true
    
        property string completeSoundSrc: "qrc:/controls/sounds/Alarm01.wav"
    
        Component.onCompleted:
        {
            soundPlayer.volume = 1.0
            soundPlayer.source = ""
        }
    
        onPlaying:
        {
            soundPlayer.isReadyToPlay = false
        }
    
        onStopped:
        {
            soundPlayer.isReadyToPlay = true
        }
    
        function setVolume(volume)
        {
            if (volume > 1.0)
            {
                soundPlayer.volume = 1.0
            }
            else if (volume < 0.0)
            {
                soundPlayer.volume = 0.0
            }
            else
            {
                soundPlayer.volume = volume
            }
        }
    
        function playCompleteSound()
        {
            if (soundPlayer.isReadyToPlay === true)
            {
                soundPlayer.source = soundPlayer.completeSoundSrc
                soundPlayer.play()
            }
        }
    }
    
    Button
    {
        width: 50
        height: 50
        
        onButtonClicked:
        {
            soundPlayer.playCompleteSound()
        }
    }

  • Moderators

    You have that Alarm01.wav file compiled into application's resources, right?

    Maybe check if wav is supported using https://doc.qt.io/qt-5/qmediaplayer.html#hasSupport.

    Plus, make sure you have all Qt's dependencies, for example by running:

    sudo apt build-dep qt5-qmake
    


  • @sierdzio

    After I converted it to mp3 file, It available to play on Qt.
    But [Warning: "Could not get/set settings from/on resource."] message is still showing..

    and I already running that command line command :(


Log in to reply