文档

Unity Engine

Unity Engine

url

The file URL or web URL that the VideoPlayer reads content from.
阅读时间1 分钟最后更新于 1 个月前

Definition

public string url { get; set; }

Remarks

In addition to URLs, this property also accepts raw paths to local files. The raw paths can either be absolute on the platform or relative to the Player root.
If the user sets both a VideoPlayer.clip and a VideoPlayer.url, the one that was set last takes precedence.
Examples:

Examples

using UnityEngine; using UnityEngine.Video; public class UrlExample : MonoBehaviour{ VideoPlayer videoPlayer; private void Start() { // Get the VideoPlayer component from the GameObject that contains this script. videoPlayer = GetComponent<VideoPlayer>(); // Using an absolute raw path to a local file. videoPlayer.url = "/Users/graham/movie.mov"; // Using a relative raw path to a local file. videoPlayer.url = "subdirectory/videofiles/movie.mov"; // Using a web URL. videoPlayer.url = "https://ia904602.us.archive.org/25/items/big-buck-bunny_202112/Big%20Buck%20Bunny.mp4"; // Using a file URL. videoPlayer.url = "file:///Users/graham/movie.mov"; }}