Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-128738

MediaPlayer on android device can't find default audio output

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.2
    • Multimedia
    • None
    • Android

    Description

      The program Examples/Qt-6.7.2/demos/mediaplayer on an Android 14 tablet with a connected bluetooth 5.0 speaker and set as default audio output does not immediately play the sound on the speaker, but first on the built-in speakers and then after several seconds on the Bluetooth speaker. It seems that when starting the program there is no AudioInput devices by default.

      1- open a sample mp4 file on the Android device with bluetooth speaker connected : the sound is directly on bluetooth speaker

      2- launch demos/mediaplayer on the same device and load the same mp4 video file : the movie is correctly played but the song is thirst played on built in speaker and after a few seconds on bluetooth speaker

      in another program by putting this code in the constructor of my class

      const QList<QAudioDevice> audioDevices = QMediaDevices::audioOutputs();
       for (const QAudioDevice &device : audioDevices)

      {     qDebug() << "AudioDevice output ID: " << device.id() << Qt::endl;     qDebug() << "Description: " << device.description() << Qt::endl;     qDebug() << "Is default: " << (device.isDefault() ? "Yes" : "No") << Qt::endl; }

      i see this debug

      AudioDevice output ID:  "2" 
      Description:  "Built in speaker (SM-T220)" 
      Is default:  No 
      AudioDevice output ID:  "352" 
      Description:  "Bluetooth (Music Care)" 
      Is default:  No 
       

      In my qml file :

      MediaPlayer {
              id: bellSound
              source: "sounds/bell.mp3"
              audioOutput: AudioOutput

      {             id: audioOutputBell             volume: 1         }

          }
       when bellSound.play() first the sound is out from the Built-In speacker and after a few second to the Bluetooth speaker

      gradle.properties :
      androidBuildToolsVersion=34.0.0

      androidCompileSdkVersion=android-34

      androidNdkVersion=26.1.10909125

      buildDir=build

      qt5AndroidDir=~/Qt/6.7.2/android_arm64_v8a/./src/android/java

      qtAndroidDir=~/Qt/6.7.2/android_arm64_v8a/./src/android/java

      qtMinSdkVersion=23

      qtTargetAbiList=arm64-v8a

      qtTargetSdkVersion=34

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtmultimediateam Qt Multimedia Team
              chavant Chavant Julien
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes