I have an app that plays video files with no audio. I'm using the mediaplayer function. I want to have the videos play, but not output anything to audio, as there is no audio tracks. However, Android ducks all other audio output (music, for example) when my app is running. Is there a way to use mediaplayer and completely remove my app from audio streams?
I've reviewed Google's Managing Audio Focus article, and I can't devise a way to do so. I just want to use mediaplayer for the video, and completely forget about audio.
Is there a different function I have to call in mediaPlayer.setAudioStreamType?
you can mute all the audio streams using the below code snippet
AudioManager am = (AudioManager)NextVideoPlayer.this.getSystemService(Context.AUDIO_SERVICE);
am.setStreamMute(AudioManager.STREAM_MUSIC, true);
Related
I'd like to create an App that plays an audio file/stream to the microphone to allow a video communication App to capture the sound as input.
To Play the Audio I'm currently using the AudioTrack class.
The closest question is this one, but still unanswered.
I m using Exo Media Player 2.5.0 to stream audio from a remote source . i want to pause the audio when other apps play Audio/Video .
As ADM said, the only way to know if another app is going to play audio is by listening to audio focus changes (after requesting audio focus for your own app first, of course).
Aside from that, you're, unfortunately, at the mercy of the other app also playing nicely and it requesting audio focus when it wants to play.
I have mute video file and separate audio file for same video. How can I play video with separate audio in android? I have tried using VideoView but unable to play audio separately. can anyone help in this!!
Before you start everything running, first you prepare both video and audio. When both of them are prepared only after that you can push the Start button.. and they should be synchronized ( if you recorded the audio part at the same time you started the video part)
I am developing an application in which I have to perform three functions play, record and pause an audio file.
Has anyone implemented it before?
Take a look at MediaPlayer or AudioTrack for playback. The difference is that MediaPlayer can play several audio formats directly from file (or in some cases even from remote URL), while AudioTrack plays only from raw LPCM buffer,
For recording take a look at MediaRecorder or AudioRecord. The difference is that MediaRecorder records audio and video to .3gp, while AudioRecord gives you only audio as raw LPCM buffers. The AudioRecord data can be used to create .wav files (though some extra code is required for this).
I have made a Android streaming application that plays media from online URL's. For playing the media, I am using the
standard MediaPlayer class for playing media.
As per the Android documentation, it supports RTSP protocol for audio & video playback
http://developer.android.com/guide/appendix/media-formats.html
But when I am trying to play media from a RTSP URL, it gets connected but I am not able to hear any media
Following is one of those RTSP URL -
rtsp://sfera.live24.gr/sfera4132
Does anybody media have an idea of playing RTSP URL's through the Android MediaPlayer
Thanks
That link you provided has 3 audio tracks, with the first and last tracks appearing to be silent and don't contain any valid audio.
The middle track has audio (as per VLC). I don't know how Android deals with multiple audio tracks. I imagine you may get better results if you use links that only contain 1 audio and 1 video track at most.
I expect for an rtsp stream with multiple audio tracks, android is only going to play the first one as there is no user interface to select a specific audio stream, hence why you aren't hearing any audio.
If this is a stream from your own server, to hear the audio you should adjust the SDP file the valid audio track first. If this is not from your server, I don't know what you're options are.