How can I make the video work properly with visual also?

Viewed 33

For some time I've made an app and I have a very weird problem. I have two activities. One is named Speech and one is named Yoga. In both of them I have multiple videos with web url. The videos in Speech work perfectly. But in Yoga, when the video starts, the screen remains black, and only the audio works and the MediaController. I noticed this happenes only on some phone resolutions (Ex: for samsung A50 the video works normal, but for samsung j3 it doesn't.) I thought the problem is caused because of the video specs so I am going to show you the specs of the videos:

Speech video(the video that works: Lenght: 1:21 Frame width:1080 Frame height:1860 Data rate:584kbts Size:7.53 MB

Yoga video(the video that doesn't work: Lenght: 8:15 Frame width:1080 Frame height:2260 Data rate:720kbts Size:42 MB

The code is the same for both:

 VideoView videoView = findViewById(R.id.speech);
    videoView.setVideoPath("my_url");

    MediaController mc = new MyMediaController(videoView.getContext());
    mc.setMediaPlayer(videoView);
    videoView.setMediaController(mc);
    videoView.requestFocus();
    videoView.start();

    videoView.setOnCompletionListener(mp -> onBackPressed());

Layout:

<VideoView
    android:id="@+id/s"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/gridLayout7">

</VideoView>

The videos were made in the same way also. Thank you in advance.

0 Answers
Related