0

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 :

  1. 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.

  2. Also from res/raw folder path videos does play fine.

  3. 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.

  4. 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.

Jay Rathod
  • 11,131
  • 6
  • 34
  • 58
  • there is a list of formats which are 100% supported by Android. Are you sure that your video is in one of those formats? – Vladyslav Matviienko Nov 29 '18 at 07:19
  • @VladyslavMatviienko Yes videos are in .mp4 format and it does play on Nougat version TV box as well as in Emulators of both versions. But only Marshmallow Version TV box seems to be throw this alert Can't play this video each time. – Jay Rathod Nov 29 '18 at 07:28
  • `.mp4` is not what I'm talking about, it is not the video format, it is the file format, which is only the container for video. If it plays on other devices it still does not mean that it is in the supported format. Other devices may support any non-mandatory formats, which the manufacturers added supports for. – Vladyslav Matviienko Nov 29 '18 at 07:39
  • @VladyslavMatviienko Relate to *Format / Codec* actually i didn't have any idea relate to this because videos are playing from URL directly. And as said working fine on few device and emulators. – Jay Rathod Nov 29 '18 at 07:46
  • same thing, `working fine on few device and emulators.` does not mean that they are in correct format. Manufacturers may add **any** format support, but there are mandatory ones, which work on every Android device. You will have to check which format/codec are your videos encoded with. – Vladyslav Matviienko Nov 29 '18 at 07:49
  • @VladyslavMatviienko But if i download that video and put it in my local server and then set that URL to video then videos does play fine again on that Version 6 TV box. So do you think this has to be any connection with format/codec ? – Jay Rathod Nov 29 '18 at 08:24
  • ok, that way it is weird. Then I don't think it is something wrong with encoding. Unless you convert it on-the-fly while downloading. You may try the google's ExoPlayer library, which is likely able to play your video – Vladyslav Matviienko Nov 29 '18 at 08:26

0 Answers0