async void PickFile(object sender, RoutedEventArgs e)
        {
            var currentState = Windows.UI.ViewManagement.ApplicationView.Value;

            if (currentState == Windows.UI.ViewManagement.ApplicationViewState.Snapped && !Windows.UI.ViewManagement.ApplicationView.TryUnsnap())
            {
                TranscodeError("Cannot pick files while application is in snapped view");
            }
            else
            {
                Windows.Storage.Pickers.FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker();
                picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
                picker.FileTypeFilter.Add(".wmv");
                picker.FileTypeFilter.Add(".mp4");

                Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();

                if (file != null)
                {
                    Windows.Storage.Streams.IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

                    _InputFile = file;
                    InputVideo.SetSource(stream, file.ContentType);
                    InputVideo.Play();

                    // Enable buttons
                    EnableButtons();
                }
            }
        }
        public ActionResult <string> Post([FromBody] InputVideo video)
        {
            string output = "output.avi";
            string path   = @"..\VideoConverter\bin\Debug\converter\";

            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.CreateNoWindow         = false;
            startInfo.UseShellExecute        = false;
            startInfo.FileName               = Path.Combine(path, "ffmpeg.exe");
            startInfo.Arguments              = $"-y -i {path + video.VideoUrl} -vf 'scale={video.TargetSize}:-1' {path + output}";
            startInfo.RedirectStandardOutput = true;
            //startInfo.RedirectStandardError = true;

            try
            {
                using (Process process = Process.Start(startInfo))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        string line = process.StandardOutput.ReadLine();
                        Console.WriteLine(line);
                    }

                    process.WaitForExit();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return("completed");
        }
示例#3
0
        void InputPlayButton_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (InputVideo.DefaultPlaybackRate == 0)
            {
                InputVideo.DefaultPlaybackRate = 1.0;
                InputVideo.PlaybackRate        = 1.0;
            }

            InputVideo.Play();
        }
示例#4
0
 async void StopPlayers()
 {
     await _dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         if (InputVideo.CurrentState != MediaElementState.Paused)
         {
             InputVideo.Pause();
         }
         if (OutputVideo.CurrentState != MediaElementState.Paused)
         {
             OutputVideo.Pause();
         }
     });
 }
示例#5
0
        async void PickFile(object sender, RoutedEventArgs e)
        {
            Windows.Storage.Pickers.FileOpenPicker picker = new Windows.Storage.Pickers.FileOpenPicker();
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.VideosLibrary;
            picker.FileTypeFilter.Add(".wmv");
            picker.FileTypeFilter.Add(".mp4");

            Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                Windows.Storage.Streams.IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

                _InputFile = file;
                InputVideo.SetSource(stream, file.ContentType);
                InputVideo.Play();

                // Enable buttons
                EnableButtons();
            }
        }
示例#6
0
 void InputPauseButton_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     InputVideo.Pause();
 }
示例#7
0
 void InputStopButton_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     InputVideo.Stop();
 }
示例#8
0
        private void OnDialogSelected(object sender, DialogModel model)
        {
            InputPeer inputPeer = null;

            if (!(model is DialogModelPlain))
            {
                return;
            }

            DialogModelPlain dmp = (DialogModelPlain)model;

            if (fromMedia == 1)
            {
                MessageMedia media = MediaTransitionHelper.Instance.Media;

                InputMedia im = null;
                if (media.Constructor == Constructor.messageMediaPhoto)
                {
                    MessageMediaPhotoConstructor mmpc = (MessageMediaPhotoConstructor)media;
                    InputPhoto ip = TL.inputPhoto(((PhotoConstructor)mmpc.photo).id, ((PhotoConstructor)mmpc.photo).access_hash);

                    im = TL.inputMediaPhoto(ip);
                }
                else if (media.Constructor == Constructor.messageMediaVideo)
                {
                    MessageMediaVideoConstructor mmvc = (MessageMediaVideoConstructor)media;
                    InputVideo iv = TL.inputVideo(((VideoConstructor)mmvc.video).id, ((VideoConstructor)mmvc.video).access_hash);

                    im = TL.inputMediaVideo(iv);
                }
                else if (media.Constructor == Constructor.messageMediaGeo)
                {
                    MessageMediaGeoConstructor mmgc = (MessageMediaGeoConstructor)media;
                    GeoPointConstructor        gpc  = (GeoPointConstructor)mmgc.geo;

                    InputGeoPoint point = TL.inputGeoPoint(gpc.lat, gpc.lng);
                    im = TL.inputMediaGeoPoint(point);
                }

                if (im != null)
                {
                    dmp.SendMedia(im);
                    NavigationService.GoBack();
                }

                return;
            }

            if (messageId.Count == 0)
            {
                logger.error("error forwarding, no messageId");
            }

            Peer peer = model.Peer;

            if (model.IsChat)
            {
                inputPeer = TL.inputPeerChat(((PeerChatConstructor)peer).chat_id);
            }
            else
            {
                inputPeer = TL.inputPeerContact(((PeerUserConstructor)peer).user_id);
            }

            DoForwardMessages(inputPeer);

            int modelId = TelegramSession.Instance.Dialogs.Model.Dialogs.IndexOf(model);

            NavigationService.Navigate(new Uri("/UI/Pages/DialogPage.xaml?modelId=" + modelId, UriKind.Relative));
        }
示例#9
0
 void InputPauseButton_Click(Object sender, RoutedEventArgs e)
 {
     InputVideo.Pause();
 }
示例#10
0
 void InputStopButton_Click(Object sender, RoutedEventArgs e)
 {
     InputVideo.Stop();
 }
示例#11
0
 public override void Read(BinaryReader reader)
 {
     this.id = Tl.Parse <InputVideo>(reader);
 }
示例#12
0
 public InputMediaVideoConstructor(InputVideo id)
 {
     this.id = id;
 }