2
  • I,ve one mute video and another audio file and I want to play those
    files simultaneously.

  • Means, when I play video then audio should be play of another file at the same time.

  • I used VideoView to play video, now I want to merge different audio with this video. I want to do this for localization of video.

    For Ex. I've one mute video and different language audios (like English, Hindi, German) and want to do localization for it. When I'll choose English language then it should play that MUTE video with English language audio and same with the others.

    Is it possible? If yes then what is the solution? I searched a lot but din't get the answers. Your answer will great help for me.

  • To play video used videoView like below;

    Uri UriPath = Uri.parse
            ("android.resource://com.nousguide.gmroii.gmroii/" + R.raw.vdo);
    video = (VideoView) findViewById(R.id.videoview);
    controller = new MediaController(VideoActivity.this);
    video.setMediaController(controller);
    video.setVideoURI(UriPath);
    video.requestFocus();
    video.start();
    
  • And just used the Audio Track code like below;

    at = new AudioTrack(AudioManager.STREAM_MUSIC, 44100,
            AudioFormat.CHANNEL_CONFIGURATION_MONO,   AudioFormat.ENCODING_PCM_16BIT,
            AudioTrack.getMinBufferSize(44100,
                    AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT), AudioTrack.MODE_STREAM);    
    try{
        music = new byte[512];
        at.play();
    
        while((i = is.read(music)) != -1)
            at.write(music, 0, i);
    
    } catch (IOException e) {
        e.printStackTrace();
    }
    at.stop();
    at.release();    
    

    But, not getting what to do and how to integrate it. Or should I used Audio Track for it or not? If not then what to use?

    Thanks a lot!

  • Welcome to StackOverflow! You are supposed to show code that you have already tried to write yourself and eventually get help on making it work. – quasoft Jan 14 '17 at 15:50
  • `VideoView` might be wrong tool for this... Try using Android SDK's [**`MediaPlayer`**](https://developer.android.com/guide/topics/media/mediaplayer.html) Class to play both your audio/video files. _"How to mute a video's volume?"_ there's an [**Answer in the manual**](https://developer.android.com/reference/android/media/MediaPlayer.html) find the section about `setVolume` command... – VC.One Jan 14 '17 at 19:18
  • VC. One, Thanks for the update, I'll check and update u soon... – Antariksh Jan 14 '17 at 20:57
  • @quasoft, I uploaded the above code. Any solution please? – Antariksh Jan 15 '17 at 07:50
  • As VC.One suggested, you can try accessing the internal media player inside VideoView and reducing the volume of that. This answer shows how: http://stackoverflow.com/a/14572755/2939061. – quasoft Jan 15 '17 at 08:31
  • Thanks VC One and quasoft for the answer. But, I already did the same thing to mute the video in videoView but, I din't upload that code. The main concerns is to play different video and different audio at same time, till then I'll try to "accessing the internal media player inside VideoView". It'll be better if you provide me any example for it. Thanks a lot for sharing your valuable time for me! – Antariksh Jan 16 '17 at 10:18

0 Answers0