Ejemplo n.º 1
0
        public void BuildCompositionObjects(Boolean playBack)
        {
            if (Clips == null || Clips.Count == 0)
            {
                Composition      = null;
                VideoComposition = null;
                AudioMix         = null;
                return;
            }

            SizeF videoSize         = Clips [0].NaturalSize;
            var   composition1      = AVMutableComposition.Create();
            var   videoComposition1 = AVMutableVideoComposition.Create();
            var   audioMix          = AVMutableAudioMix.Create();

            composition1.NaturalSize = videoSize;

            BuildTransitionComposition(composition1, videoComposition1, audioMix);
            if (videoComposition1 != null)
            {
                videoComposition1.FrameDuration = new CMTime(1, 30);
                videoComposition1.RenderSize    = videoSize;
            }

            Composition      = composition1;
            VideoComposition = videoComposition1;
            AudioMix         = audioMix;
        }
Ejemplo n.º 2
0
        public void BuildCompositionObjects(bool playBack)
        {
            if (Clips == null || Clips.Count == 0)
            {
                Composition      = null;
                VideoComposition = null;
                return;
            }

            var videoSize   = Clips [0].NaturalSize;
            var composition = AVMutableComposition.Create();
            AVMutableVideoComposition videoComposition = null;

            composition.NaturalSize = videoSize;

            // With transitions:
            // Place clips into alternating video & audio tracks in composition, overlapped by transitionDuration.
            // Set up the video composition to cycle between "pass through A", "transition from A to B",
            // "pass through B".

            videoComposition = AVMutableVideoComposition.Create();


            //Set CustomVideoCompositorClass based on the Compositor user selected.

            if (TransitionType == TransitionTypeController.DiagonalWipeTransition)
            {
                videoComposition.CustomVideoCompositorClass = new MonoTouch.ObjCRuntime.Class(typeof(DiagonalWipeCompositor));
            }
            else
            {
                videoComposition.CustomVideoCompositorClass = new MonoTouch.ObjCRuntime.Class(typeof(CrossDissolveCompositor));
            }

            buildTransitionComposition(composition, videoComposition);
            if (videoComposition != null)
            {
                // Every videoComposition needs these properties to be set:
                videoComposition.FrameDuration = new CMTime(1, 30);
                videoComposition.RenderSize    = videoSize;
            }
            Composition      = composition;
            VideoComposition = videoComposition;
        }
Ejemplo n.º 3
0
        public void BuildCompositionObjectsForPlayback(bool playback)
        {
            if (Clips == null || Clips.Count == 0)
            {
                this.composition      = null;
                this.videoComposition = null;
            }
            else
            {
                var videoSize          = Clips[0].NaturalSize;
                var mutableComposition = AVMutableComposition.Create();
                AVMutableVideoComposition mutableVideoComposition = null;

                mutableComposition.NaturalSize = videoSize;

                // With transitions:
                // Place clips into alternating video & audio tracks in composition, overlapped by transitionDuration.
                // Set up the video composition to cycle between "pass through A", "transition from A to B",
                // "pass through B".

                mutableVideoComposition = AVMutableVideoComposition.Create();
                if (TransitionType == TransitionType.DiagonalWipeTransition)
                {
                    mutableVideoComposition.CustomVideoCompositorClass = new ObjCRuntime.Class(typeof(DiagonalWipeCompositor));
                }
                else
                {
                    mutableVideoComposition.CustomVideoCompositorClass = new ObjCRuntime.Class(typeof(CrossDissolveCompositor));
                }

                BuildTransitionComposition(mutableComposition, mutableVideoComposition);
                if (mutableVideoComposition != null)
                {
                    // Every videoComposition needs these properties to be set:
                    mutableVideoComposition.FrameDuration = new CMTime(1, 30);
                    mutableVideoComposition.RenderSize    = videoSize;
                }

                this.composition      = mutableComposition;
                this.videoComposition = mutableVideoComposition;
            }
        }