Hello. It was necessary to make an activity with a video in full screen and on top of it a crawl line. I realized all this, but when you need to play videos of a larger size (up to 1080p), everything lags terribly, sometimes it slips

I / Choreographer: Skipped 38 frames! The application may be doing too much work on its main thread.

The code for the application is the simplest:

<VideoView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/videoView" /> <TextView android:id="@+id/textView" android:singleLine="true" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:layout_height="30dp" android:layout_width="match_parent"> </TextView> 

Activity code:

  VideoView videoView = (VideoView)findViewById(R.id.videoView); videoView.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.video); videoView.setMediaController(new MediaController(this)); videoView.requestFocus(0); videoView.start(); mText = (TextView) findViewById(R.id.textView); mText.setText("Много текста "); mText.setSelected(true); 

AndroidTV application, so you need to play such a high-quality video. I tried VideoView, mediaplayer + surfaceView, and exoPlayer. Actually the question is: what can be done with this so that the application does not slow down?

  • and without a "running line" does not slow down? - Vladyslav Matviienko
  • @metalurgus, without a running line, everything is fine. - Alexander Vitalev
  • But how long is the text in TextView? how many characters? - Vladyslav Matviienko
  • @metalurgus did not count, each time in different ways, but the text always does not fit on the screen. - Alexander Vitalev
  • Tried to run a video in a separate trade? - Android Android

1 answer 1

Try to use not VideoView, but MediaPlayer in conjunction with SurfaceView, while redefining Surface (not my idea, taken from here - https://stackoverflow.com/questions/20772575/how-to-add-textview-to-dynamic-surfaceview- android ) as the code:

 public class MySurfaceView extends SurfaceView { Paint paint; public MySurfaceView() { Paint paint = new Paint(); paint.setColor(Color.BLACK); paint.setTextSize(25); setWillNotDraw(false); } public class onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawText("Your Text", 10, 10, paint); } }