2

I implemented an application run on Raspberry Pi 3 using Android Things. This application will be able to play rtsp video and output to screen via HDMI port. But the audio is not working with jack 3.5mm. Below is my code:

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        VideoView videoView = findViewById(R.id.video_view);
        videoView.setVideoPath("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");
        videoView.start();
    }
}

How can I fix it?

2
  • 1
    Is the audio currently being sent to the HDMI display? In other OS's (Raspbian, etc.) you need to select to either send audio out the HDMI or the 3.5" stero jack. Maybe look for a similar audio-output selection capability in Android Things? I found a relevant (but not 100% same) answer that might help you here: stackoverflow.com/questions/42035890/…
    – MrChips
    Dec 1, 2017 at 19:23
  • I had a similar issue with android things on a pi using the android.speech.tts.TextToSpeech library. Here is my code. I could only get audio to play out of the USB port. The mini RCA (headphone jack) and HDMI ports were silent. Jan 10, 2019 at 19:38

3 Answers 3

2

The problem is that if you connect the hdmi first, it will use the hdmi as the audio output.

Try connecting the audio jack first. This solved it for me.

0

If you cannot get the 3.5" jack working, Android Things also supports USB audio as well. A viable solution might be to just get a $7 USB audio card that has 3.5mm jacks on it, something like this:

Generic USB audio card with 3.5mm jacks for speaker and microphone

I found a good question/answer related to this in another post HERE.

Good Luck, and please write back here to let us know what you found!

2
  • OK I will try your solution. If I find some things I will let you know.
    – mr.icetea
    Dec 2, 2017 at 1:58
  • I have tried this solution and it seems not to be working out of the box. I suspect that following code should be implemented as part of Android Things audio management : developer.android.com/things/sdk/drivers/audio.html
    – Jviaches
    Apr 8, 2018 at 4:16
0

Add this line in config.txt file:

hdmi_ignore_edid_audio=1
1
  • 1
    Thank you for your answer. While this might work, it might be beneficial to explain why. Also, if you would provide the qualified path of config.txt, it would probably help.
    – Bex
    Nov 3, 2019 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.