Reputation: 122
I'm developing an Android app that plays streaming video in a VideoView. I'm able to get the video to play and stop without issue, but I'm just wondering if there's a way to detect if the person that is actually streaming the video has stopped streaming the video? As far as I can tell if the person controlling the stream stops his video or changes the server it's running from, it appears as if the VideoView has stopped, but it actually is playing nothing. Am I correct in that assumption?
Upvotes: 1
Views: 1050
Reputation: 8371
I doubt there's any protocol to let listening clients know that a stream has been manually stopped on the server end. It would probably just look like a network issue. If you're just interested in knowing that a stream has failed, then adding an onError listener will tell you that the stream has failed (after the buffer was exhausted). You may need to analyze the what and extra parameters to determine what type of error has occurred. Without an onError listener, the onCompletion listener will be called.
videoView.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.w(TAG, "Video playback has errored");
return false;
}
});
Upvotes: 1