0

I have an Android App in which I am playing media streams from URL. Streams are playing fine on all devices except two: Nexus 7 OS 5.0.2 and another Nexus 4 OS 6.0.1. On these devices occasionally OnCompletionListener() is fired while playing at random intervals (ranging from 30 seconds to 10 mins).

All these streams seem to be working fine on other devices (I haven't got another device running OS 6.0.1) but OS 5.0.1 and OS 5.1 works nicely.

I have searched for almost two days on google for a solution or even a similar case but haven't found anything.

So these are my questions

  1. Is this an issue with Nexus devices?
  2. If so then is there a way to correct this behavior?

EDIT 1 : There is no SeekBar or MediaController since all the streams are live. The code for initializing VideoView

 if (videoView == null)
            videoView = new ExtVideoView(mContext);
        videoPlayerLlyout.addView(videoView);

        videoView.setVideoURI(Uri.parse(playLink));
        videoView.screenMode = ExtVideoView.DisplayMode.FULL_SCREEN;

        videoView.setOnCompletionListener(this);
        videoView.setOnErrorListener(this);
        videoView.setOnPreparedListener(this);
        videoView.setOnTouchListener(this);

And then in the onPrepared()

if(!isFragmentPaused)
    {
        mp.start();
    }

    mp.setOnBufferingUpdateListener(this);
    mp.setOnInfoListener(this);
    mp.setOnSeekCompleteListener(this);

In the onCompletion() method I am simply playing the next live-stream item in a list.

Abbas
  • 3,529
  • 5
  • 36
  • 64
  • 1
    Please provide some code which includes media player start and also the code at you are seeking the media i.e. seek bar code. – Dushyant Suthar Jul 21 '16 at 13:10
  • I'm saying this a lot lately: start the `MeadiPlayer` in a `Service` and bind it to a `Notification` with `startForeground()`. This will certainly help. On 5.0 this was the ONLY way to solve it for me, but I need to see your mp initialization code. – midiwriter Jul 22 '16 at 19:53
  • @Mike I dont get what u r saying. There is no need to initialize mp since the wrapper class VideoView (ExtVideoView) already takes care of that. Also I'm not sure how binding the mediaplayer to a service would stop giving me unwanted onCompletion() calls. Please explain ur answer. – Abbas Jul 22 '16 at 20:00

0 Answers0