Question by
atomodelfinal · Sep 04, 2021 at 01:37 PM ·
androidunity 2dandroid build
Black screen instead of playing video
I made an app for Android. When the button "PLAY" is pressed, the current scene is changed and a video is played at the beginning of the next scene. This works as it should in the editor.
However, in 30% of the smartphones I used to test the app it just showed a black screen with no video audio playing. Am I doing something wrong?
I'm using the next code to play the video:
#region variables
//variables
public OnButtonDown buttonHoldScript;
public SceneManag sceneManage;
public VideoPlayer[] vidArray;
public GameObject firstButton;
public GameObject secondButton;
Button btn1;
Button btn2;
Button.ButtonClickedEvent onClick;
#endregion
void Start()
{
PowerOnIsOn();
}
public void PowerOnIsOn()
{
firstButton.SetActive(true);
secondButton.SetActive(false);
btn1 = firstButton.GetComponent<Button>();
btn2 = secondButton.GetComponent<Button>();
foreach (VideoPlayer vp in vidArray)
{
vp.playOnAwake = true;
if (vp == vidArray[0])
{
vp.Play();
vp.isLooping = true;
}
else
{
vp.Pause();
}
}
}
Comment