On some devices like Sansung S5, and some specific devices, the video that I put on splashscreen is not displayed. The device says: "This video can not be played." The video is in .mp4 format
The Logcat tells me that I have the following error:
E / MediaPlayer: error (1, -2147479527) E / MediaPlayer: error (1, -38) D / VideoView: Error: 1, -2147479527
What is the proper way to implement images and videos in Android Studio so that ALL the devices display them?
I do not know if it has something to do but the video that I try to reproduce, which is called "intro", weighs 4.40Mb and measures 1400 x 2440
Is it true that if I put a lot of comments or leave spaces between the lines of the code, do I load the RAM and the Activity does not work well?
Thank you.
// JAVA ARCHIVE:
package com.hem.personal.hem;
import android.content.Context; import android.content.Intent; import
android.content.SharedPreferences; import android.media.MediaPlayer; import
android.net.Uri; import android.os.Bundle; import
android.support.v7.app.AppCompatActivity; import android.util.Log; import
android.view.WindowManager; import android.widget.VideoView; import
com.crashlytics.android.Crashlytics; import io.fabric.sdk.android.Fabric;
public class splashscreen extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
//ESCONDE EL STATUS BAR
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//ESCONDE EL STATUS BAR
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
setContentView(R.layout.splashscreen);
getSupportActionBar().hide();
videoView = findViewById(R.id.videoView);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/" +
R.raw.intro);
videoView.setVideoURI(video);
videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener()
{
@Override
public void onCompletion(MediaPlayer mediaPlayer)
{ if (isFinishing())
return;
}
});
videoView.start();
}}
// XML FILE:
<VideoView
android:id="@+id/videoView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />