Log in or register to post comments

Video player problem

January 28, 2014 - 1:07am #1

Hi,

I'm trying to build a simple project which uses cloud recognition and creating a videoplayer. My application also reads JSON which holds some texture, texture link url. There is no problem with downloading texture, integration with JSON or if I pre-define video url also video player works when application finds my target. All working fine.

But my problem is when I assign a url from JSON data to video component, it just stops and shows error_icon. 

Any suggestion to where should I change video path ?

Video player problem

April 13, 2016 - 11:11am #9

I'm experiencing this same issue, I do have the mVideoPlayer.SetFilename code in the Video Playback Behaviour script, I change the mpath value from the metadata found in my cloud target but it always shows the error image on the video texture. I know this doesn't work on pc but when I run the test mode on the pc in the inspector I can see that my URL is updated correctly in the script but never plays.

Video player problem

January 29, 2014 - 6:58am #8

Well seems like I was missing that point. Problem solved.

Thanks for your help NalinS!

Video player problem

January 29, 2014 - 6:07am #7

Looking at the code in VideoPlaybackBehaviour:

 

        // 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);

 

Are you calling mVideoPlayer.SetFilename with the newly updated path ?

 

N

 

 

 

Video player problem

January 29, 2014 - 4:46am #6

After changing path of video by this line ->

video.m_path = "http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4";

Application tracking images correctly, then getting video player but the state of video player is allways 'error' (shows X on vplayer)

The only line I added to original code is above. Seems like I'am changing the path on wrong code place or 'Should I use video.VideoPlayer.Unload() method'?

Video player problem

January 29, 2014 - 3:10am #5

Here I want to change the video path but it's not answering

What exactly do you mean by this?

What problem are you seeing?

What happens when you step through it in the debugger?

 

N

 

Video player problem

January 29, 2014 - 2:16am #4

m_path variable can be define in prefab, I know. 

I allready achieved that play video from url or pre-define video url on VideoPlaybackBehaviour.cs. But I'm tryin to change path in TrackableEventHandler.cs because I take path data from JSON(or I can take from metadata)

Regards
OGPoyraz

Video player problem

January 28, 2014 - 11:57pm #3

Hello NalinS,
Thanks for reply. Actually my real problem is with m_path variable. For example in VideoPlayback / TrackableEventHandler.cs
 

private void OnTrackingFound()
    {
        Renderer[] rendererComponents = GetComponentsInChildren<Renderer>();
        Collider[] colliderComponents = GetComponentsInChildren<Collider>();

        // Enable rendering:
        foreach (Renderer component in rendererComponents)
        {
            component.enabled = true;
        }

        // Enable colliders:
        foreach (Collider component in colliderComponents)
        {
            component.enabled = true;
        }

        Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");

        // Optionally play the video automatically when the target is found

        VideoPlaybackBehaviour video = GetComponentInChildren<VideoPlaybackBehaviour>();

        //Here I want to change the video path but it's not answering. This one loads busy icon everytime.
        //So where should I change m_path in TrackableEventHandler.cs ?
	video.m_path = "http://oneshot.qualcomm.com/webAR/content/strawberryfields_H264_AAC.mp4";

        if (video != null && video.AutoPlay)
        {
            if (video.VideoPlayer.IsPlayableOnTexture())
            {
                VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus();
                if (state == VideoPlayerHelper.MediaState.PAUSED ||
                    state == VideoPlayerHelper.MediaState.READY ||
                    state == VideoPlayerHelper.MediaState.STOPPED)
                {
                    // Pause other videos before playing this one
                    PauseOtherVideos(video);

                    // Play this video on texture where it left off
                    video.VideoPlayer.Play(false, video.VideoPlayer.GetCurrentPosition());
                }
                else if (state == VideoPlayerHelper.MediaState.REACHED_END)
                {
                    // Pause other videos before playing this one
                    PauseOtherVideos(video);

                    // Play this video from the beginning
                    video.VideoPlayer.Play(false, 0);
                }
            }
        }

        mHasBeenFound = true;
        mLostTracking = false;
    }

Take a look at 26. line for problem.
Thanks. 
OGPoyraz

Video player problem

January 28, 2014 - 6:19am #2

In VideoPlayBackBehaviour there is the m_path variable:

    /// <summary>
    /// URL of the videoeither a path to a local file or a remote address
    /// </summary>
    public string m_path = null;

Note that the URL needs to be the actual remote file, plus whatever is hosting it needs to have the relevant http streaming protocols, otherwise it will not play.

N

Log in or register to post comments