Unity Video Player
New unity video player component has been introduced lately from Unity. I have had a chance to play around with the component in my applications.
I am going explain as much as I can. Here is how it looks like:
I will try to explain things one by one.
- Video Clip – It can be a video clip imported inside unity project.
- URL – You can play a video directly from a URL be it served over web or file:// protocols.
Play On Awake
If you keep this checked unity video player will automatically play your video as soon as you run the project.
Wait For First Frame
If you keep this checked unity video player will wait till it gets the first frame of the video loaded into the memory.
Self explanatory, helps you if you want to loop your video and want it to play itself again when it ends.
It helps you speed up or down your video speed.
It requires more than just one line explanation. It has 5 different rendering modes as shown:
Camera Far Plane
Render the video on the Camera’s far plane.
Camera Near Plane.
Render the video on the Camera’s near plane.
Render the video into a Render Texture.
Render the video into a selected Texture property of a GameObject through its Renderer’s Material.
Render the video into the VideoPlayer.texture Scripting API property. You must use scripting to assign the Texture to its intended destination.
The aspect ratio of the images that fill the Camera Near Plane, Camera Far Plane or Render Texture when the corresponding Render Mode is used.
Following are the aspect ratio options we have:
No scaling is used. The video is centered on the destination rectangle.
Scale the source to fit the destination rectangle vertically, cropping the left and right sides or leaving black areas on each side if necessary. The source aspect ratio is preserved.
Scale the source to fit the destination rectangle horizontally, cropping the top and bottom regions or leaving black areas above and below if needed. The source aspect ratio is preserved.
Scale the source to fit the destination rectangle without having to crop. Leaves black areas on the left and right or above and below as needed. The source aspect ratio is preserved.
Scale the source to fit the destination rectangle without leaving black areas on the left and right or above and below, cropping as required. The source aspect ratio is preserved.
Scale both horizontally or vertically to fit the destination rectangle. The source aspect ratio is not preserved.
Then comes another crucial part of how you want your video’s audio to be considered. Do you want no audio, play directly on the hardware or do you want to do audio tweaking as well. For that you will have to select Audio Source option.
If you select Audio source as the option you will have to provide the reference of the audio source component where you want the audio to be played through. Then in that audio source component you can do the tweaking.