简体   繁体   English

在Unity中播放一系列360度视频

[英]Play a sequence of 360-degree videos in Unity

I am looking to play a sequence of 360-degree videos in Unity through a C# script. 我希望通过C#脚本在Unity中播放一系列360度视频。 Each video has a corresponding audio of the same duration (extracted using Ffmpeg)and which should play in sync with the video. 每个视频具有相同的持续时间(使用Ffmpeg提取)的相应音频,并且应与视频同步播放。 I also want to display a grey screen of 1 second duration between each video. 我还想在每个视频之间显示1秒持续时间的灰屏。

I have tried a similar script which was provided in stackoverflow (with some slight modifications) that can play normal videos in sequence. 我尝试了stackoverflow中提供的类似脚本(稍作修改),该脚本可以按顺序播放普通视频。 The script uses a RawImage on a canvas to render the video. 该脚本在画布上使用RawImage渲染视频。 I am trying to modify it to a Sphere instead of RawImage, then use the flipverticals shader on the sphere and render the 360-video to the sphere. 我试图将其修改为Sphere而不是RawImage,然后在球体上使用flipverticals着色器并将360视频渲染到球体。 Not sure about this approach. 不确定这种方法。

// 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;

I expect to be able to play a sequence of 360-degree videos - the number and names of the video should be supplied at run-time. 我希望能够播放一系列360度视频-视频的编号和名称应在运行时提供。

    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;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM