I have developed an Android TV app which is based on Google leanback library
.
The videos does play fine on emulators
as well as in Version (7) Nougat
TV Box.
But when we test it in Android Version (6)
Marshmallow TV box then when going to play videos it is showing Can't play this video alert message on screen immediately.
What it tried is :
Put static Google Sample video URL (http://commondatastorage.googleapis.com/android-tv/Sample%20videos/April%20Fool's%202013/Introducing%20Google%20Nose.mp4) in video path to cross verify and it does play without any issues.
Also from res/raw folder path videos does play fine.
But when i try to set actual URL of my videos which i get from API's it always showing can't play this video only in Marshmallow version.
Also videos does play fine on
Emulators
as well of both versions.
Here is some code.
mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Log.d("video", "setOnErrorListener ");
return true;
}
});
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
if (mPlaybackState == PlaybackState.PLAYING) {
mVideoView.start();
}
mp.setOnVideoSizeChangedListener(new MediaPlayer.OnVideoSizeChangedListener() {
@Override
public void onVideoSizeChanged(MediaPlayer mp, int width, int height) {
progressBar.setVisibility(View.GONE);
mp.start();
}
});
mp.setOnInfoListener(new MediaPlayer.OnInfoListener() {
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
switch (what) {
case MediaPlayer.MEDIA_INFO_BUFFERING_START:
progressBar.setVisibility(View.VISIBLE);
break;
case MediaPlayer.MEDIA_INFO_BUFFERING_END:
progressBar.setVisibility(View.GONE);
break;
}
return false;
}
});
}
});
mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
/*mPlaybackState = PlaybackState.IDLE;*/
mp.start();
}
});
So i am not able to identify the exact reason behind always showing Can't play this video on version Marshmallow
.
I am stuck with this issue.
Really need help to resolve this issue on Android Marshmallow TV Box
version.
Any help will be greatly appreciated.
Let me know in case if any details required.