Log in or register to post comments

Metadata and VideoPlayer.Load

October 18, 2016 - 8:54pm #1

Hello,

I need help to understand better how to solve this problem, i'm stuck on it at least 2 days. I guess I change almost everything about videobehaviour and it didn't work so well.

My question: 

I already identify and retrieve a url video from metadata and when I'll put this url on Video path it doesn't work, here's the code:

 

string urlvideo = "SERVER/URLNAME.URLTYPE";

string typeModel = "video";

   string urlvideo = j["URL_ANDROID"].ToString().Replace("\"","");

   if (typeModel.Equals("video")) {

    VideoPlaybackBehaviour video = GetComponentInChildren<VideoPlaybackBehaviour>();

    if (video != null && video.AutoPlay)

    {

     if (video.VideoPlayer.IsPlayableOnTexture()) // IT RETURNS FALSE EVERYTIME SO IT CANN'T LOAD PROPERLY

     {

      if( video.VideoPlayer.Load(urlvideo, VideoPlayerHelper.MediaType.ON_TEXTURE, true, 0.0f ) ){             

       Debug.Log("success");

       VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus();

       if (state == VideoPlayerHelper.MediaState.PAUSED ||

        state == VideoPlayerHelper.MediaState.READY ||

        state == VideoPlayerHelper.MediaState.STOPPED)

       {

        PauseOtherVideos(video);

        video.m_path = urlvideo;  

        Debug.Log("Resume Play");              

        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.m_path = urlvideo;  

        video.VideoPlayer.Play(false, 0);

       }

      }else{                      

       Debug.Log("failure");                

      }

     }

     ShowScanLine(false);

    }

Log in or register to post comments