Log in or register to post comments

Can Virtual Buttons load Video ?

February 26, 2013 - 8:40pm #1

Hi,  

Is it possible to load video content in a  virtual button scene ?

 

 

Can Virtual Buttons load Video ?

October 30, 2013 - 7:09am #5

I want to play a video when the virtual button is pressed. But I can make it happen. No luck. Anyone can help me to solve my problem? Just send me an email at

thanks, 

 

regards

rezhahino

Can Virtual Buttons load Video ?

March 5, 2013 - 1:15am #4

Hi, the process is already documented in my previous message;

for more detailed step-by-step procedure, you may want to send a message to mickbanks, as perhaps he succeded in applying the process (or maybe a slightly different procedure) .

Can Virtual Buttons load Video ?

March 5, 2013 - 12:14am #3

Hi 

I tried combining the both i.e., videos and virtual buttons but ended with no luck.

Can any one plz explain me the procedure in step by step.

Suggessions also appreciated.

Its urgent to me. Plz help.

Can Virtual Buttons load Video ?

February 27, 2013 - 12:36am #2

Hi, you can combine the scripts of the VideoPlayback sample with the ones of the VirtualButtons samples, it does not really matter which sample you start from;

however, the way I would do it is probably by starting with the VirtualButtons sample and do the following:

  • copy the Prefabs from the VideoPlayback sample
  • attach a "video object (using a video perfab) to your image target
  • Create a script that implements the IVirtualButtonEventHandler interface and register it as a handler for a virtual button
  • in particular, implement the OnButtonPressed and/or OnButtonReleased so to start a video when the virtual button is "pressed" or "released"
  • in the OnButtonPressed (or OnButtonReleased if you prefer), put the code to play the video; for instance, if you want to play the video fullscreen you could end up with some code similar to the following (this is inspired by the code in VideoPlaybackController.cs):
    void OnButtonPressed()
    {
        if (video != null)
        {
            if (video.VideoPlayer.IsPlayableFullscreen())
            {
                // Pause the video if it is currently playing
                video.VideoPlayer.Pause();

                // Seek the video to the beginning();
                video.VideoPlayer.SeekTo(0.0f);

                // Display the busy icon
                video.ShowBusyIcon();

                // Play the video full screen
                video.VideoPlayer.Play(true, 0);
                mWentToFullScreen = true;
            }
        }
    }

You can have a look at the VideoPlaybackController.cs script for inspiration, however you probably don't need that script; you rather need to extract the relevant code (like the one that I have shown above) and copy it into your VirtualButtonEventHandler class, with some little adaptations.

I hope this helps.

Log in or register to post comments