示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        _videoDecoder   = new VideoDecoder();
        _spriteRenderer = GetComponent <SpriteRenderer>();
        _videoDecoder.OnFrameRendered += OnFrameRendered;

        _backgroundTask = Task.Run(() =>
        {
            var sourceFile = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
            var frameIndex = 1000;
            _videoDecoder.Run(sourceFile, frameIndex);
        });
        // _backgroundTask.Wait();
    }
示例#2
0
        public IEnumerator DecodeFrameToTexture2D_Frame5_ShouldSaveImage()
        {
            // Given
            // var sourceFile = "/Users/madison/Dropbox/game_development/VideoSnapshot/Assets/Tests/capture123.h264";
            var videoDecoder = new VideoDecoder();
            var sourceFile   = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov";
            var frameIndex   = 50;

            // When
            videoDecoder.Run(sourceFile, frameIndex);

            // Then
            yield return(null);

            Assert.IsTrue(UnityEngine.Windows.File.Exists($"image_{frameIndex:D5}.png"));
        }