Esempio n. 1
0
        public void CreateMediaFromFileStream()
        {
            // TODO: fix this.
            var media = new Media(new Instance(), new FileStream(RealMediaPath, FileMode.Open, FileAccess.Read, FileShare.Read));

            media.Parse();
            Assert.NotZero(media.Tracks.First().Data.Audio.Channels);
        }
Esempio n. 2
0
        public void CreateRealMedia()
        {
            var instance = new Instance();
            var media    = new Media(instance, RealMediaPath, Media.FromType.FromPath);

            Assert.False(media.IsParsed);
            media.Parse();

            //await media.ParseAsync();
            Assert.True(media.IsParsed);
            Assert.NotZero(media.Duration);
            Assert.NotZero(media.Tracks.First().Data.Audio.Channels);
            Assert.AreEqual(Media.MediaParsedStatus.Done, media.ParsedStatus);
            Assert.AreEqual(Media.MediaType.File, media.Type);
        }
        public void DurationChanged()
        {
            var  media    = new Media(new Instance(), RealMediaPath, Media.FromType.FromPath);
            var  called   = false;
            long duration = 0;

            media.EventManager.DurationChanged += (sender, args) =>
            {
                called   = true;
                duration = args.Duration;
            };

            media.Parse();

            Assert.True(called);
            Assert.NotZero(duration);
        }