A vertical line is displayed to the right of the screen when playing video in VideoView

I have a problem when playing a video in VideoView, display vertically on the video screen, the following code works fine in Samsung Galaxy TabPro, but the vertical line is displayed right on the video screen when running in Android TV smart box.

activity_video_layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black">

    <VideoView
        android:id="@+id/video_activity_videoView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:background="@color/black" />
    <ProgressBar
        android:id="@+id/video_activity_progressBar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />
</RelativeLayout>

      

VideoActivity.java

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_video_layout);
        mVideoView = (VideoView) findViewById(R.id.video_activity_videoView);
        mMc = new CustomMediaController(this);
        mMc.setFocusable(true);
        mVideoView.setMediaController(mMc);
        mVideoView.setOnFocusChangeListener(new OnFocusChangeListener() {                               
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                if (hasFocus) {
                    if (mMc != null) mMc.show(5000);
                } else {
                    if (mMc != null) mMc.hide();
                }
            }
        });

        mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener()  {
            @Override
            public void onPrepared(MediaPlayer mp) {                         
                if (Constant.DEBUG) Log.d(TAG, "Duration = " + mVideoView.getDuration() 
                        + ", Type = " + mType + ", mHasPermission = " + mHasPermission); 
                if (mTimer == null && mHasPermission == false) {
                    mTimer = new Timer(true);
                    mTimer.schedule(new timerTask(), 1000, 1000);
                }   

                mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {                   
                    @Override
                    public void onBufferingUpdate(MediaPlayer mp, int percent) {
                        if (Constant.DEBUG) Log.d(TAG, "percent = " + percent);
                        if (mIsReady == false) {
                            mIsReady = true;
                         mVideoView.setBackgroundColor(getResources().getColor(R.color.none));
                        ProgressBar progressBar = (ProgressBar) findViewById(R.id.video_activity_progressBar);
                        if (progressBar.getVisibility() != View.GONE) progressBar.setVisibility(View.GONE);
                        }
                    }
                });
            }
        });

        mType = getIntent().getIntExtra("type", Constant.PRG_TYPE_CHARGE);
        mHasPermission = getIntent().getBooleanExtra("permission", true);
        mId = getIntent().getStringExtra("id");
        String playTime = getIntent().getStringExtra("play_time");
        if (playTime != null) {
            mPlayTime = Integer.valueOf(playTime) * 1000;
            Log.d(TAG, "mPlayTime = " + mPlayTime);
        }
        mString = getIntent().getStringExtra("url");
        if (mString == null) {
            finish();
        } else {
            mVideoView.setVideoURI(Uri.parse(mString));
            if (mPlayTime != 0) {
                showContinueDialog();
            } else {
                mVideoView.requestFocus();
                mVideoView.start();     
            }
        }
    }

      

Any help would be greatly appreciated. Thank.

+3


source to share





All Articles