Log in or register to post comments

Black Box issue in the unity Android app

March 18, 2020 - 9:49am #1

Hello,



I am creating an augmented reality app on unity using vuforia for android. My application has 6 videos loading on detecting an image. The application works perfectly in the play mode of unity. But when I build the android app, black boxes appear in place of my videos (probably before the videos are loaded) for 1-2 seconds. How can I correct this?

I have already tried including them in the Pre-loaded assets in the project settings.



Regards,

Gayatri sravani Akella

Black Box issue in the unity Android app

March 19, 2020 - 7:24am #4

You looked at the unity docs for VideoPlayer? prepareCompleted is probably what you want.

Black Box issue in the unity Android app

March 18, 2020 - 11:09am #3

Thank you for replying. I have checked in the playback methods but I can't find anything wrong.

I have the videos loading in separate quads with their own videoplayers. My code is as below -

using System;

using System.Collections;

using System.Collections.Generic;

using Lean.Touch;

using UnityEngine;

using UnityEngine.Video;

using UnityEngine.UI;

public class QuadPress1 : MonoBehaviour

{

    public GameObject quadObject;

    public FadeInOut1 script;

    public VideoClip[] vids = new VideoClip[8];

public AudioClip[] audioClipArray;

    private Collider quadCollider;

    private UnityEngine.Video.VideoPlayer quadPlayer;

    private AudioSource quadAudio;

public System.DateTime startTime;

public double timeInt;

    private bool vidPlaying;

    private bool enter = false;

private bool playFlag;

    public int delay;

    private bool playStop;

private int count;

string fQuad = "";

public System.DateTime ts;

private double timespan;

//public startPlaying myParent;

    void Start()

    {

        delay = 10;

        playStop = false;

  playFlag = false;

        quadPlayer = quadObject.GetComponent<UnityEngine.Video.VideoPlayer>();

        quadAudio = quadObject.GetComponent<AudioSource>();

        quadCollider = quadObject.GetComponent<MeshCollider>();

  //myParent = transform.parent.GetComponent<parentscriptclass>();

        vidPlaying = false;

  quadPlayer.clip = vids[count];

  quadAudio.clip = audioClipArray[count];

    }

    void Update()

    {

        var fingers = LeanTouch.Fingers;

        if (delay > 0)

        {

            delay--;

        }

        else

        {

            if (fingers.Count == 1)

            {

                Ray ray = Camera.main.ScreenPointToRay(fingers[0].ScreenPosition);

                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))

                {

                    if (hit.collider == quadCollider)

                    {                      

                        playStop = true;

     

                        delay = 1;

                    }

                }

            }

            if (playStop && !quadPlayer.isPlaying)

            {

    if(quadPlayer.GetComponentInParent<Toggle>().isOn){

     quadPlayer.Play();

     quadAudio.Play();

     playStop = false;

     delay = 10;

     vidPlaying = true;

     this.transform.parent.GetComponent<startPlaying1>().startTime = System.DateTime.Now;

     quadPlayer.GetComponentInParent<Toggle>().isOn = false;



    }

    else{

     ts = System.DateTime.Now;

     timespan = (ts - this.transform.parent.GetComponent<startPlaying1>().startTime).TotalSeconds;

     if(playFlag == false)

     StartCoroutine(waitToPlay());//plays the videos with a time gap

    }

            }

            else if (playStop && !script.fadeOut)

            {

    if(enter == false)

    StartCoroutine(your_timer()); //waits for sometime before the video fadesout

            }

            if (!quadPlayer.isPlaying && vidPlaying)

            {

    if(enter == false)

    StartCoroutine(your_timer2()); //waits for sometime before the video fadesout

            }

        }

    }

}

Black Box issue in the unity Android app

March 18, 2020 - 10:06am #2

Take a look at the callback methods for Videoplayer, should be one that tells you when the video is ready.  Hide before that and in that method show it.

Log in or register to post comments