Forum Xamarin.Forms

Xamarin forms Exoplayer playback speed not working

AjoyMandalAjoyMandal USMember ✭✭

I am working with xamarin forms app. I used Exoplayer to play audio. Audio playing successfully, but when I used code for playback speed, giving error Java.Lang.ClassNotFoundException: 'Didn't find class "android.media.PlaybackParams". My code

    PlayerEventListener listerner;
    SimpleExoPlayer _player = ExoPlayerFactory.NewSimpleInstance(_context, defaultTrackSelector);
    _player.AddListener(listerner);            
    _player.Prepare(extractorMediaSource);
    _player.PlayWhenReady = true;
    PlaybackParams param = new PlaybackParams();
    param.SetSpeed(2f);
    _player.SetPlaybackParams(param);

Please tell me how to increase playback speed. Thanks..

Best Answer

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    Accepted Answer

    Try to use following code directly.

     PlaybackParameters param = new PlaybackParameters(2f);
     _player.PlaybackParameters=param;
    

    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Answers

  • LeonLuLeonLu Member, Xamarin Team Xamurai
    Accepted Answer

    Try to use following code directly.

     PlaybackParameters param = new PlaybackParameters(2f);
     _player.PlaybackParameters=param;
    

    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

  • AjoyMandalAjoyMandal USMember ✭✭

    Thank you very much. Your solution is working successfully. One more things when we start play music , have to set PlaybackParameters for speed. But when song is running , any time how to change speed? Just like youtube.

  • LeonLuLeonLu Member, Xamarin Team Xamurai

    If the reply is helpful, please accept it as answer(Click the Yes under the answer). If you have another question, please open a new thread for this issue, keep one thread for one question.

Sign In or Register to comment.