Forum rules - please read before posting.

Controlling and change video player.

edited December 2017 in Technical Q&A

Hello Chris! I'm prototyping an adventure game which works purely and exclusively with videos (.mov). So the player interacts directly with videos and hotspots to trigger actions etc... that are displayed on the screen. A mechanics almost identical of "Sierra's Phantasmagoria" for example.

The point in question is the following. Is there any way to get different videos to play on the same jpg texture (that is my action area)? And controlling the order. For example, when a line of dialogue ends, we move on to the next video. But always using the main camera and on the same texture?

So for now my working method is so far the following:

1 texture with videocoponent + 1 camera for each scene.
Eg: Character1 + ChracterCamera1 and  Character2 + CharacterCamera2

So once one ends, the camera change to the to the next one and stop the playback of the previous video. And it gives play to the second video. I do not know if this is the right way or the best way. The problem is that it becomes somewhat extensive and complicated to work on the actionlist. Besides, within the same scene I have 1 texture and camera for each part that must change.

Hope I've have been as clear as possible. Thank you!
An screen of how it's looks my workflow. (texture with video player comp, + camera) one for each.
image

Comments

  • Assuming you're just using Unity 5.6 Video Player Component, you can use their API (https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html) to change the video which is being displayed on the texture by setting VideoPlayer.clip:

    Given the tutorial to write a custom action:

    I've written a custom action which allows you to change, and optionally play, the video which is being used on a Video Player component. I'm hoping for a new Code Snippets section on the wiki, but for now grab the script here:

    This should be named ActionVideoPlayerSetClip.cs and should be put in the /Scripts/Actions/Custom folder, or whatever your custom action folder is set to.

    Now you can create a new action, Custom > VideoPlayer SetClip
    image

    - You need to specify your Video Player Component (screen)
    - You need to specify what Video Clip to change to
    - You can toggle "Play Clip" to have the new clip play automatically. 

    Selzier



  • Welcome to the community, @Dave, and thanks for the contribution @Selzier!

    I think it would be worth having an option to change the video clip directly within AC's own Engine: Play movie Action.  However, the save system would also need upgrading to store such a change - otherwise save games could get broken.  I'll look into making these changes as part of the next update.
  • Thank you both for the quick  response! Selzier, i will check :) It would be great to have this kind of feature on the next updates :)
  • Indeed, I've marked it for inclusion in the next release.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.