Search Unity

Video autoplay not working.

Discussion in 'Vuforia' started by ssuresh1295, Oct 10, 2017.

  1. ssuresh1295

    ssuresh1295

    Joined:
    Jul 13, 2017
    Posts:
    20
    Hi,

    I am using vuforia video player prefab. And I am downloading the prefab from the server at runtime and I have attached VideoPlaybackBehaviour script. and also set autoPlay = true. But it's not auto-playing its showing play button after clicks only it's playing.

    My code is

    Code (CSharp):
    1. VideoPlaybackBehaviour video = videoPlayerGameObject.GetComponent<VideoPlaybackBehaviour>();
    2.  
    3.                 video.m_autoPlay = true;
    4.                 Debug.Log("Autoplay is " + video.AutoPlay);
    5.                 video.m_path = videoUrl;
    6.  
    7.                 // Pause other videos before playing this one
    8.                 // Play this video on texture where it left off
    9.      
    10.                 if (video != null && video.AutoPlay)
    11.                 {
    12.                  
    13.                         VideoPlayerHelper.MediaState state = video.VideoPlayer.GetStatus();
    14.                         if (state == VideoPlayerHelper.MediaState.PAUSED ||
    15.                             state == VideoPlayerHelper.MediaState.READY ||
    16.                             state == VideoPlayerHelper.MediaState.STOPPED)
    17.                         {
    18.                             // Pause other videos before playing this one
    19.                             PauseOtherVideos(video);
    20.  
    21.                             // Play this video on texture where it left off
    22.                             video.VideoPlayer.Play(false, 0);
    23.                         }
    24.                         else if (state == VideoPlayerHelper.MediaState.REACHED_END)
    25.                         {
    26.                             // Pause other videos before playing this one
    27.                             PauseOtherVideos(video);
    28.  
    29.                             // Play this video from the beginning
    30.                             video.VideoPlayer.Play(false, 0);
    31.                         }
    32.                  
    33.                 }

    Can you tell what is the mistake here?.

    For ARCamera I have attached VideoPlayBackController
    For ImageTargetI have attached TrackableEventController
    For Video.prefabI have attached VideoPlayBackBehaviour