Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            switch (platform)
            {
            case "a":
            case "A":
            case "ac":
            case "AC":
            case "AcFun":
            case "ACFun":
                player.Load($@"{AcFunLiveServer.Server.Address}/{id}");
                break;

            case "b":
            case "B":
            case "bili":
            case "Bili":
            case "bilibili":
            case "Bilibili":
            case "BiliBili":
                player.Load($@"{BilibiliLiveServer.Server.Address}/{id}");
                break;

            default:
                Close();
                break;
            }
            player.Resume();
        }
Esempio n. 2
0
 private void ReloadWallpaper()
 {
     if (Wallpaper != null && player != null)
     {
         player.Load(Wallpaper.AbsolutePath);
         player.Resume();
     }
 }
Esempio n. 3
0
        private void SetupPlayer()
        {
            player = new MpvPlayer("lib\\mpv-1.dll")
            {
                AutoPlay = true
            };

            playerHost.Children.Add(player);

            player.MediaLoaded     += PlayerOnMediaLoaded;
            player.MediaUnloaded   += PlayerOnMediaUnloaded;
            player.PositionChanged += PlayerOnPositionChanged;

            player.EnableYouTubeDl(@"scripts\ytdl_hook.lua");
            player.YouTubeDlVideoQuality = YouTubeDlVideoQuality.MediumHigh;

            player.Load(@"https://www.youtube.com/watch?v=E5ln4uR4TwQ");
            player.Load(@"https://www.youtube.com/watch?v=SNoK5pyK73c");
        }
Esempio n. 4
0
        private void SetFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog Fdialog = new OpenFileDialog();

            Fdialog.Filter = "Video Files (*.mp4 *.avi *.flv *.gif *.wmv *.amv )|*.mp4;*.avi;*.flv;*.gif;*.wmv;*.amv;" + "|All Files|*.*";
            if (Fdialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                SetUri.IsEnabled = false;
                filePath         = Fdialog.FileName;
                fileName         = Path.GetFileNameWithoutExtension(Fdialog.FileName);
                Console.WriteLine(filePath);
                Console.WriteLine(fileName);
                PathLabel.Content = filePath;
                Title.Text        = fileName;
                Save.IsEnabled    = true;
                player.Load(filePath);
                player.Resume();
            }
        }
Esempio n. 5
0
 public void SetMedia(string url, int position, int lang, int sub)
 {
     currURL = url;
     player.Load(url);
     if (!isChannel)
     {
         positionOnLoad    = position;
         SetPositionOnLoad = true;
     }
     currLang = lang;
     currSub  = sub;
 }
Esempio n. 6
0
        public MainWindow()
        {
            InitializeComponent();

            player = new MpvPlayer(PlayerHost.Handle)
            {
                Loop   = true,
                Volume = 50
            };
            player.Load("http://techslides.com/demos/sample-videos/small.mp4");
            player.Resume();
        }
        public VideoPlayerForm(string videoPath, bool allowSkippingForward = true)
        {
            _allowSkippingForward = allowSkippingForward;

            InitializeComponent();

            if (!_allowSkippingForward)
            {
                skipForwardSimpleButton.Enabled = false;
            }

            if (videoPath is null || string.IsNullOrWhiteSpace(videoPath) || !File.Exists(videoPath))
            {
                MessageBox.Show("There was an error loading this video, the player will now close.",
                                "Error Loading Video", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }

            videoEditorControlsPanel.Location = new Point(0, Height);

            _hideTimer = new System.Timers.Timer {
                Interval = 4000
            };
            _hideTimer.Elapsed += _hideTimer_Elapsed;
            _hideTimer.Enabled  = true;

            _exitButtonTimer = new System.Timers.Timer {
                Interval = 4000
            };
            _exitButtonTimer.Elapsed += _exitButtonTimer_Elapsed;
            _exitButtonTimer.Enabled  = true;

            _exitButtonTimer.Start();

            var tempPathLocation = $@"{Path.GetTempPath()}{Guid.NewGuid()}mpv-1.dll";

            File.Copy($@"{Environment.CurrentDirectory}\mpv-1.txt", tempPathLocation);
            _player = new MpvPlayer(videoPlayerPanel.Handle, tempPathLocation)
            {
                Volume = 100
            };

            _player.Load(videoPath);
            _player.PositionChanged += _player_PositionChanged;
            _player.MediaLoaded     += _player_MediaLoaded;
            _player.MediaFinished   += _player_MediaFinished;
            _player.Resume();

            playPauseSimpleButton.Click += PlayPauseSimpleButton_ClickForPause;
        }
Esempio n. 8
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            Channels channels = Channels.Get();

            if (chList.SelectedItems.Count > 0)
            {
                ListViewItem item    = chList.SelectedItems[0];
                ChannelInfo  channel = channels.GetChannel(int.Parse(item.SubItems[0].Text));
                if (channel == null)
                {
                    MessageBox.Show(item.SubItems[1].Text);
                }
                else
                {
                    player.Stop();
                    isChannel = channel.ChannelType == ChType.CHANNEL;

                    isPaused = false;
                    Thread.Sleep(500);
                    player.Load(channel.URL);
                    try
                    {
                        string        chName = channel.TVGName.Length < 100 ? channel.TVGName : channel.TVGName.Substring(0, 99);
                        Task <string> stats  = Utils.GetAsync("" + chName);
                    } catch (Exception ex)
                    {
                        Console.WriteLine("HATA GÖNDERME İSTATİSTİKLERİ");
                    }

                    logoChannel.LoadCompleted -= logoLoaded;

                    logoChannel.Image = Image.FromFile("./resources/images/nochannel.png");
                    if (!string.IsNullOrEmpty(channel.TVGLogo))
                    {
                        logoChannel.LoadAsync(channel.TVGLogo);
                        logoChannel.LoadCompleted += logoLoaded;
                    }

                    string title = channel.Title;
                    if (title.Length > 20)
                    {
                        title = title.Substring(0, 20) + "...";
                    }
                    lbChName.Text  = title;
                    currentChannel = channel;
                    currentChType  = channel.ChannelType;
                    SetEPG(channel);
                }
            }
        }
Esempio n. 9
0
        Project OpenProject(string filename, bool asBackup = false)
        {
            var project = Project.Read(filename, asBackup);

            settings.LastProject = filename;
            Title = GetTitle(project, project.SelIndex);
            if (!string.IsNullOrEmpty(project.VideoPath))
            {
                player.Load(project.VideoPath);
            }

            //project.Subtitles = project.Subtitles.OrderBy(subtitle => subtitle.Start).ToList();

            RecalculateIndexes(project.Subtitles);
            RecalculateIndexes(project.RefSubtitles);

            LoadSubtitles(project, timeline);
            LoadRefSubtitles(project, timeline);

            Task.Delay(200).ContinueWith(t => {
                Dispatcher.Invoke(() => {
                    timeline.HorizontalOffset = project.ScrollPos;
                    Seek(TimeSpan.FromSeconds(project.VideoPos), null);
                });
            });


            timeline.SelectedItems.CollectionChanged -= Timeline_SelectedItems_CollectionChanged;
            listView.SelectionChanged -= ListView_SelectionChanged;
            timeline.SelectedItems.Add(project.Subtitles[project.SelIndex]);
            listView.SelectedIndex     = project.SelIndex;
            listView.SelectionChanged += ListView_SelectionChanged;
            timeline.SelectedItems.CollectionChanged += Timeline_SelectedItems_CollectionChanged;

            return(project);
        }