- Playing Video In Unity - Introduction and Session Goals [1/8]:
- Video Player with First Person Shooter (FPS):
- Create a scene to play using a video player and a FPS character by shooting it.
- When we shoot the Play button, the video player will play a video clip on our giant video screen and the Play button will turn into a Stop button.
- The video has been rendered in real time into a texture of a stretched out cube and at the end it will loop back to the beginning.
- At the bottom of the screen, the length of the clip and the current time in minutes and seconds are displayed.
- If we shoot the Next button, the next video clip will be player.
- If we shoot the Stop button, the video will freeze
- Session Goals:
- Learn how to play video automatically using the Video Player component by dropping a video in the editor and play it when the scene starts.
- Learn how to control the Video Player via C# script.
- Learn to create a 3D video player that players can interact with using first person shooter (FPS) controls including:
- how to display the time from the video on the UI, and
- how to map video into an object.
- Assets Download:
- Overview of Video Player:
- Import video clips and play them using the Video Player component.
- The system allows us to feed video footage directly into the Texture parameter of any component that has one. Unity then plays the video on that Texture at run time. There are two different ways to do that.
- Unity's video features include the hardware-accelerated and software decoding of video files, transparency support, multiple audio tracks, and network streaming.
- The Video Player component and Video Clip asset, introduced in Unity 5.6, supersede the earlier Movie Texture feature.
- Next Step:
- Set up the video player to play on its own in a scene before we get into the scripting.
- Get a quick overview of the Video Player.
- Playing Video In Unity - The Video Player Component [2/8]:
- Set up a separate Static Video Player in space. It's an empty game object with an Audio Source attached. We also have a Camera which is a child of the game object, and there is a Cube in front of the Camera.
- If we want to display our video and have it played automatically when our scene starts, all we need to do is add a component which is under Video > Video Player.
- The Video Player works in a way very similar to the Audio Source works.
- The first thing is to decide what is the Source for this Video Player:
- a video clip in our assets, or
- a URL. You can streaming in video from a server by providing a URL.
- We are going to use Video Clip mode and we have a field for a video clip asset.
- Drag and drop a video clip from the asset folder into the Video Clip slot.
- Play On Awake: The checkbox should be checked which means as soon as the game object wakes and receives the awake callback. In this case, it will be the start of the scene.
- Wait For First Frame: The checkbox should be checked means starting the counter only when the first frame is actually ready such that there is no perceptible delay in this setup. (Or, we can start the counter and wait for the video to catch up.)
- Loop: Should be on and we can adjust the Playback Speed.
- Render Mode: Render Texture is the default and we will use the render texture for our 3D example. However, for now, we are going to use Camera Far Plane mode so that we can see them.
- Camera: This empty field came up due to our selection of Camera Far Plane mode. Drag in our child Camera of the Static Video Player. We are going display the video on this Camera's Far Plane. Camera Far Plane is the huge rectangle at the end of the Camera's view right frustum, i.e., the rectangle that is the farthest plane that the camera can see. The Camera Near Plane is the smallest, nearest rectangle that the camera can see. We can choose either the Near or Far Plane mode.
- In order for these two render modes to work, we need to set the Rendering Path in our Camera to Forward by clicking Camera > Rendering Path > Forward.
- Before we start playing, we need to disable our FPS Controller by clicking FPSController > uncheck the FPSController.
- Now, we can run and the Camera (using Far Plane) will take over. Our video is the background and our scene geometry (Cube) is being drawn in front of it.
- If we switch to Near Plane, we are going to play our video in full screen.
- Aspect Ratio: Allow us to stretch or scale our video.
- Audio Output Mode: Should be in Audio Source mode. Direct mode may not be working on some platform (2017).
- Audio Source: Drag the Audio Source component to the slot as a reference.
- Track: We can choose which track to play if there are multiple tracks in the movie.
- Now, we can play the video in full screen and the audio plays through the Audio Source.
- Next Step:
- Set up the interactive 3D video player.
- Q&A:
- Can the video be played on non-flat surface? Yes, the video will be put into the Texture, so it can be played on any surface.
- Can we jump skipped video to certain point? Yes, however, you will lose audio sync. So, it only work without audio. Currently (2017), it cannot skip without losing audio sync. An alternate way is to use multiple clips.
- Playing Video In Unity - Texturing Objects With Video [3/8]:
- Playing Video In Unity - Playing and Pausing [4/8]:
- Playing Video In Unity - Playing A New Clip [5/8]:
- Playing Video In Unity - Displaying Current Time and Clip Length [6/8]:
- Playing Video In Unity - Animated Playhead [7/8]:
- Playing Video In Unity -Questions and Answers [8/8]:
Friday, July 17, 2020
Playing Videos
Subscribe to:
Post Comments (Atom)
Coordinating Multiplayer Game: Photon Bolt
Documentation : Photon Bolt Documentation Photon Bolt Engine API Overview : Feature Comparison between Bolt Pro and Bolt Free: Photon Bolt R...
-
How to make a Video Game - Getting Started Video game creation team: 3D modeling, programming, concept art and sound design. Game engine:...
-
Playing Video In Unity - Introduction and Session Goals [1/8] : Video Player with First Person Shooter (FPS): Create a scene to play using a...
-
How to make Terrain in Unity! Get Terrain Tools: Click Window > Package Manager and make sure we have All Packages selected and go under ...
No comments:
Post a Comment