Playing a video after a video in Android's TextureView has issues -


Using a MediaPlayer inside a TextureView to run the video, it works.

One video ends and the other video must be played, I change the scene of the text to the aspect ratio of the video (example - 3: 4 to 9:16 and so on ..) I change to fit

The problem is, the first video ends, this last frame is shown, the shape of the texture is changed, The last frame of the first video stays for the second part of a partition, But now with a poor aspect ratio , the other video is being played well

Image 1: Video 1, (3: 4):

Image2: Video 1, here we have 2 videos, videos 1 final fr It is between m, now it is (9:16) after the size change, but the rectangle is looking bad. The picture below is shown for the second:

Enter image details here < / P>

There is nothing special about using the code, here are some parts:

// to init TextureView and MediaPlayer: mounted on public zeros (surface surface surface mix, integer width, height of intensity) {m_MediaPlayer = new MediaPlayer (); M_Surface = new surface (surface mix); M_MediaPlayer.setSurface (m_Surface); } M_TextureView.setSurfaceTextureListener (this); // To resize: Layout: First layout = new frame layout. Layoutperms (ntvwydath, newhhite); LayoutParams.gravity = Gravity.CENTER; M_TextureView.setLayoutParams (layoutParams); // Play: m_MediaPlayer.reset (); M_MediaPlayer.setDataSource (videoFilePath); M_MediaPlayer.prepare (); // & lt; --- Here's a call to "reset", which is shown above this code m_MediaPlayer.start ();

You have some options, maybe. In principle, you can clean the surface by disconnecting the media player, clean the surface with GLES, and then connect the media player again. See the clickPlayStop () and clear page () in the graphica, it uses the MediaCode, is not a media player, so I'm not sure how it will translate.

Another option is to use TextureView conversion instead of custom frame layout to set your aspect ratio, since your layout does not change, so there is no flash of distorted frames. See adjusting aspectriteo () for an example.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -