我希望通过C#脚本在Unity中播放一系列360度视频。每个视频具有相同的持续时间(使用Ffmpeg提取)的相应音频,并且应与视频同步播放。我还想在每个视频之间显示1秒持续时间的灰屏。
我尝试了stackoverflow中提供的类似脚本(稍作修改),该脚本可以按顺序播放普通视频。该脚本在画布上使用RawImage渲染视频。我试图将其修改为Sphere而不是RawImage,然后在球体上使用flipverticals着色器并将360视频渲染到球体。不确定这种方法。
// Raw Image to Show Video Images [Assign from the Editor]
public RawImage image;
public List<VideoClip> videoClipList;
private List<VideoPlayer> videoPlayerList;
private int videoIndex = 0;
// Assign the Texture from Video to RawImage to be displayed
image.texture = videoPlayerList[videoIndex].texture;
我希望能够播放一系列360度视频-视频的编号和名称应在运行时提供。
答案 0 :(得分:0)
private GameObject textureObj; // Your sphere with a MeshRenderer
private Texture2D storeTexture; // Just a texture from assets thats use to transport the stream
private Renderer textureRenderer;
private void Start() {
this.storeTexture = videoPlayerList[videoIndex].texture;
this.textureRenderer = this.textureObj.GetComponent<Renderer>();
this.textureRenderer.material.mainTexture = this.storeTexture;
}