コード例 #1
0
        public SampleDataSource()
        {
            SampleGroup groupVideoProcessing = new SampleGroup("Group_Transcode", StringLoader.Get("Video_Processing"));

            SampleItem itemTranscode = new SampleItem(typeof(Samples.TranscodePage), "Item_Transcode", StringLoader.Get("Transcode"), "Assets/Icons/Transcode.png");

            groupVideoProcessing.Items.Add(itemTranscode);

            SampleItem itemCut = new SampleItem(typeof(Samples.CutPage), "Item_Cut", StringLoader.Get("Cut"), "Assets/Icons/Cut.png");

            groupVideoProcessing.Items.Add(itemCut);

            SampleItem itemJoin = new SampleItem(typeof(Samples.JoinPage), "Item_Join", StringLoader.Get("Join"), "Assets/Icons/Join.png");

            groupVideoProcessing.Items.Add(itemJoin);

            SampleItem itemVideoEffect = new SampleItem(typeof(Samples.VideoEffectPage), "Item_Video_Effect", StringLoader.Get("Video_Effect"), "Assets/Icons/Effect.png");

            groupVideoProcessing.Items.Add(itemVideoEffect);

            groups.Add(groupVideoProcessing);

            SampleGroup groupCapturing = new SampleGroup("Group_Capturing", StringLoader.Get("Capturing"));

            SampleItem itemCapturing = new SampleItem(typeof(Samples.CameraPage), "Item_Camera", StringLoader.Get("Camera_Capturing"), "Assets/Icons/Camera.png");

            groupCapturing.Items.Add(itemCapturing);

            groups.Add(groupCapturing);
        }
コード例 #2
0
        private void AppendEffectsMenu(String name)
        {
            ToggleMenuFlyoutItem menuItem = new ToggleMenuFlyoutItem();

            menuItem.Text = StringLoader.Get(name);

            menuItem.Click += OnEffectClicked;

            EffectsMenu.Items.Add(menuItem);
        }
コード例 #3
0
        private void StartPreview()
        {
            int videoDevice = VideoSelect.SelectedIndex;
            int audioDevice = AudioSelect.SelectedIndex;

            if (videoDevice == -1 || audioDevice == -1)
            {
                return;
            }

            ResetEffects();

            UpdateUiState(PageState.None);

            string videoDeviceId = ((ComboBoxItem)VideoSelect.SelectedItem).Name.ToString();
            string audioDeviceId = ((ComboBoxItem)AudioSelect.SelectedItem).Name.ToString();

            MediaCaptureInitializationSettings settings = new MediaCaptureInitializationSettings {
                VideoDeviceId        = videoDeviceId,
                AudioDeviceId        = audioDeviceId,
                StreamingCaptureMode = StreamingCaptureMode.AudioAndVideo,
            };

            IAsyncOperation <IPreview> previewTask;

            previewTask = cameraCapture.createPreview(PreviewWindow, settings);

            if (preview != null)
            {
                preview.start().AsTask().Wait();
            }

            previewTask.Completed = delegate {
                try {
                    preview = previewTask.GetResults();
                }
                catch (UnauthorizedAccessException) {
                    ShowMessageDialog(StringLoader.Get("Camera_Access_Denied"));
                    return;
                }

                preview.start().AsTask().Wait();

                UpdateUiState(PageState.Ready);
            };
        }
コード例 #4
0
        public void LoadMediaFile(StorageFile file)
        {
            IRandomAccessStream stream = file.OpenReadAsync().AsTask().Result;

            if (stream == null)
            {
                ShowMessageDialog(StringLoader.Get("Invalid_Media_File"));

                return;
            }

            sourceFile = file;

            mediaFileInfo = new MediaFileInfo(sourceFile);

            if (UpdateMediaInfo(mediaFileInfo) == false)
            {
                ShowMessageDialog(StringLoader.Get("Invalid_Media_File"));

                mediaFileInfo = null;
                sourceFile    = null;
                stream.Dispose();
                stream = null;

                return;
            }

            Preview.SetSource(stream, sourceFile.ContentType);

            Stop();

            double width  = this.ActualWidth;
            double height = this.ActualHeight;

            Preview.Width  = width;
            Preview.Height = height;

            SegmentSelector.Width = (width);

            SegmentSelector.Reset();

            Canvas.SetTop(SegmentSelector, height - 100);
        }
コード例 #5
0
        private void OnTranscode(object sender, RoutedEventArgs e)
        {
            if (Preview.File == null)
            {
                ShowMessageDialog(StringLoader.Get("Please_Pick_Media_File"));

                return;
            }

            Preview.Stop();

            destinationFileName = Preview.File.Name + ".transcoded.mp4";

            mediaComposer = new MediaComposer(this);

            SetTranscodeParameters();

            mediaComposer.setTargetFile(new File(KnownFolders.VideosLibrary, destinationFileName));

            DoTranscode();
        }