public void AddAudioAndVideo()
        {
            // test all the overloads for AddVideoWithAudio

            using (ITimeline timeline = new DefaultTimeline())
            {
                timeline.AddVideoGroup(24, 320, 240).AddTrack();
                timeline.AddAudioGroup().AddTrack();

                IAudioVideoClipPair clip1 = timeline.AddVideoWithAudio("1sec.wmv");
                Assert.AreEqual(0, clip1.AudioClip.Offset);
                Assert.AreEqual(1, clip1.AudioClip.Duration);
                Assert.AreEqual(0, clip1.VideoClip.Offset);
                Assert.AreEqual(1, clip1.VideoClip.Duration);

                IAudioVideoClipPair clip2 = timeline.AddVideoWithAudio("1sec.wmv", 1);
                Assert.AreEqual(2, clip2.AudioClip.Offset);
                Assert.AreEqual(1, clip2.AudioClip.Duration);
                Assert.AreEqual(2, clip2.VideoClip.Offset);
                Assert.AreEqual(1, clip2.VideoClip.Duration);

                IAudioVideoClipPair clip3 = timeline.AddVideoWithAudio("1sec.wmv", 0, 0.5);
                Assert.AreEqual(3, clip3.AudioClip.Offset);
                Assert.AreEqual(0.5, clip3.AudioClip.Duration);
                Assert.AreEqual(3, clip3.VideoClip.Offset);
                Assert.AreEqual(0.5, clip3.VideoClip.Duration);

                IAudioVideoClipPair clip4 = timeline.AddVideoWithAudio("1sec.wmv", 0, 0.5, 1.0);
                Assert.AreEqual(3.5, clip4.AudioClip.Offset);
                Assert.AreEqual(0.5, clip4.AudioClip.Duration);
                Assert.AreEqual(0.5, clip4.AudioClip.MediaStart);
                Assert.AreEqual(3.5, clip4.VideoClip.Offset);
                Assert.AreEqual(0.5, clip4.VideoClip.Duration);
                Assert.AreEqual(0.5, clip4.VideoClip.MediaStart);

                IAudioVideoClipPair clip5 = timeline.AddVideoWithAudio("1sec.wmv", InsertPosition.Absolute, 6, 0, -1);
                Assert.AreEqual(6, clip5.AudioClip.Offset);
                Assert.AreEqual(1, clip5.AudioClip.Duration);
                Assert.AreEqual(6, clip5.VideoClip.Offset);
                Assert.AreEqual(1, clip5.VideoClip.Duration);

                IAudioVideoClipPair clip6 =
                    timeline.AddVideoWithAudio("myclip", "1sec.wmv", InsertPosition.Absolute, 8, 0, 0.5);
                Assert.AreEqual(8, clip6.AudioClip.Offset);
                Assert.AreEqual(0, clip6.AudioClip.MediaStart);
                Assert.AreEqual(0.5, clip6.AudioClip.Duration);
                Assert.AreEqual("myclip", clip6.AudioClip.Name);
                Assert.AreEqual(8, clip6.VideoClip.Offset);
                Assert.AreEqual(0, clip6.VideoClip.MediaStart);
                Assert.AreEqual(0.5, clip6.VideoClip.Duration);
                Assert.AreEqual("myclip", clip6.VideoClip.Name);
            }
        }
Пример #2
0
 public void ShadowCopyAudio()
 {
     using (ITimeline timeline = new DefaultTimeline())
     {
         timeline.AddAudioGroup().AddTrack();
         timeline.AddVideoGroup(24, 320, 200).AddTrack();
         IAudioVideoClipPair pair = timeline.AddVideoWithAudio("..\\..\\1sec.wmv", true);
         Assert.AreEqual("..\\..\\1sec.wmv", pair.VideoClip.File.FileName);
         Assert.AreNotEqual("..\\..\\1sec.wmv", pair.AudioClip.File.FileName);
         Assert.IsTrue(pair.AudioClip.File.FileName.EndsWith(".wmv"));
     }
 }