Home > Back-end >  Xamarin Android.Media.Mediaplayer Left Right Volume not working
Xamarin Android.Media.Mediaplayer Left Right Volume not working

Time:11-24

The SetVolume function reacts only on the leftVolume setting. If I set the leftVolume between 0f and 1f the left and right volume goes up and down. If I set the rigtVolume it has no impact on the output at all. This means if for exampe, I set the leftVolume to 0f and the rightVolume to 1f, I can't hear anything. I've tested this behavior with a blue tooth inear headset and also with 3.5mm cable connected headset. In both cases the same result.

signalPlayer.SetVolume(leftVolume,rightVolume)

How can I set the volume for the right and the left channel seperately?

CodePudding user response:

I have now tested the behavior with a galaxy S20. For this phone the left right control works fine. With the NOKIA 8 which I've tested before their is still this malfunctional behavior. Therefore it seems that it depends on the phone if it works.

CodePudding user response:

I do not have the same version of you device. But you could the volumn after starting the player. It would work on most device.

 MediaPlayer signalPlayer;
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        // Create your application here
        SetContentView(Resource.Layout.layout1);
        signalPlayer = MediaPlayer.Create(this, Resource.Raw.AMBForst_48000);

        var button1 = FindViewById<Button>(Resource.Id.button1);
        button1.Click  = delegate
       {
           signalPlayer.Start();
           signalPlayer.SetVolume(1f, 1f);
       };


    }
  • Related