The Video Player component can play content imported from a variety of sources.
To create and use a Video Clip Asset, you must first import a video file.
Dragging and dropping a video file into the Project window creates a Video Clip.
Another way to create a Video Clip is to navigate to Assets > Import New Asset… to import a video file.
Once imported, the newly created Video Clip can be selected in the Video Player component using either the Select VideoClip window (accessible by clicking the circle select button to the right of the Video Clip field) or by dragging and dropping the Video Clip Asset into the corresponding Video Player component field.
Use the drop-down Source menu to set the video source to URL (this property is set to Video Clip by default). Setting Source to URL makes it possible to directly use files in the filesystem, with or without a file:// prefix.
The URL source option bypasses Asset management, meaning you must manually ensure that the source video can be found by Unity. For example, a web URL needs a web server to host the source video, while a normal file must be located somewhere where Unity can find it, indicated with scripting. However, this can be useful for situations where the content is not under Unity’s direct control, or if you want to avoid storing large video files locally.
Setting the Video Player component source to URL can also be used to read videos from web sources via http:// and https://. In these cases, Unity performs the necessary pre-buffering and error management.
Video Clips can also be read from Asset Bundles.
Once imported, these Video Clips can be used by assigning it to the Video Player component’s Video Clip field.
Files placed in Unity’s StreamingAssets folder can be used via the Video Player component’s URL option (see above), or by using the platform-specific path (Application.streamingAssetsPath).
2017–06–15 页面已发布并只进行了有限的编辑审查
New feature in Unity 5.6
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.