Playing 2 audio simultaneously - android

I'm trying to play two audio simultaneously, one of the audio plays background music, while other player plays an audio , both audios are in raw folder. Please any pointer are much appreciated .
Things which i have tried,
*) Create two media player and play the audios in separate media player instances.
*) Playing in separate thread(handler/asynchtask) ,I faced issues when i'm trying to change/cancel/stop the audio.
*) Soundpool is not suitable since the audio are of large size.

Related

ExoPlayer audio starts before video

We are having problems about the player.
We only play mp4 files.
When there is low internet connection, audio starts before the video and the video starts playing after 2-3 seconds. There is no synchronization problem meaning when video appears the audio and video synchronized. But there is a latency with the video.
What can we do about this?

Android media playback - stop audio output completely?

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);

Audio Video Playing together in android

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)

Implementing media player in Android application

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).

Problem playing media from RTSP URL in Android

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.

Categories

Resources