Log in or register to post comments

VideoPlaybackBehaviour.OnRenderObject ()

June 17, 2015 - 6:08am #1

I've integrated vuforia cloud reco and video playback and it's working fine. But in the cloud reco script i'm referencing startplay video method like below,

 

videoScript = newImageTarget_videoType.GetComponentInChildren<VideoPlaybackBehaviour> ();
 
videoScript.m_path = videoString;
 
videoScript.Startplay();
 
In VideoPlaybackBehaviour:
 
 public void Startplay()
{
// Find the icon plane (child of this object)
mIconPlane = transform.Find("Icon").gameObject;
 
// A filename or url must be set in the inspector
if (m_path == null || m_path.Length == 0)
{
Debug.Log("Please set a video url in the Inspector");
HandleStateChange(VideoPlayerHelper.MediaState.ERROR);
mCurrentState = VideoPlayerHelper.MediaState.ERROR;
this.enabled = false;
}
else
{
// Set the current state to Not Ready
HandleStateChange(VideoPlayerHelper.MediaState.NOT_READY);
mCurrentState = VideoPlayerHelper.MediaState.NOT_READY;
}
// Create the video player and set the filename
mVideoPlayer = new VideoPlayerHelper();
mVideoPlayer.SetFilename(m_path);
 
// Flip the plane as the video texture is mirrored on the horizontal
transform.localScale = new Vector3(-1 * Mathf.Abs(transform.localScale.x),
                                  transform.localScale.y, transform.localScale.z);
 
// Scale the icon
ScaleIcon();
}
 
And i removed the void start function. So, now i'm getting error in the line if (mVideoPlayer.Init() == false) on void OnRenderObject() and below NullPointer;
 
NullReferenceException: Object reference not set to an instance of an object
VideoPlaybackBehaviour.OnRenderObject () (at Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs:206)
 
But if i use the void Start menthod then the video is playing and busy texture only loading.
 
void Start()
{
// Find the icon plane (child of this object)
mIconPlane = transform.Find("Icon").gameObject;
 
// A filename or url must be set in the inspector
if (m_path == null || m_path.Length == 0)
{
Debug.Log("Please set a video url in the Inspector");
HandleStateChange(VideoPlayerHelper.MediaState.ERROR);
mCurrentState = VideoPlayerHelper.MediaState.ERROR;
this.enabled = false;
}
else
{
// Set the current state to Not Ready
HandleStateChange(VideoPlayerHelper.MediaState.NOT_READY);
mCurrentState = VideoPlayerHelper.MediaState.NOT_READY;
}
// Create the video player and set the filename
mVideoPlayer = new VideoPlayerHelper();
mVideoPlayer.SetFilename(m_path);
 
// Flip the plane as the video texture is mirrored on the horizontal
transform.localScale = new Vector3(-1 * Mathf.Abs(transform.localScale.x),
                                  transform.localScale.y, transform.localScale.z);
 
// Scale the icon
ScaleIcon();
}
 

see the attached image and red mark. It going to more than 1000 and i think affecting the main memory.

AttachmentSize
Image icon videoplaybackbehaviour.JPG30.09 KB
Log in or register to post comments