Example #1
0
        static async Task Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please enter file name as app parameter.");
                return;
            }

            string filename = args[0];

            if (!File.Exists(filename))
            {
                Console.WriteLine($"File {filename} don't exists!");
                return;
            }

            Core.Initialize();

            var mp = new MediaPlayerControl(null);
            await mp.PlayAsync(new Uri(filename));

            Console.WriteLine("Press any key to exit...");

            Console.ReadKey();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            _videoView = new VideoView();
            _videoView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            _videoView.Frame            = new CoreGraphics.CGRect(0, 0, videoView.Frame.Width, videoView.Frame.Height);
            videoView.Add(_videoView);

            edURL.Text = "https://help.visioforge.com/video.mp4";

            _mediaPlayer                   = new MediaPlayerControl(_videoView);
            _mediaPlayer.OnError          += _mediaPlayer_OnError;
            _mediaPlayer.OnPause          += _mediaPlayer_OnPause;
            _mediaPlayer.OnPlaying        += _mediaPlayer_OnPlaying;
            _mediaPlayer.OnMediaLoaded    += _mediaPlayer_OnMediaLoaded;
            _mediaPlayer.OnPositionChange += _mediaPlayer_OnPositionChange;

            btPlay.TouchUpInside    += btPlay_TouchUpInside;
            btStop.TouchUpInside    += btStop_TouchUpInside;
            btPause.TouchUpInside   += btPause_TouchUpInside;
            btOpen.TouchUpInside    += btOpen_TouchUpInside;
            slPosition.ValueChanged += slPosition_ValueChanged;
        }
Example #3
0
        public MainForm(String[] file)
        {
            InitializeComponent();
            playlist = MediaPlayerControl.playlistCollection.newPlaylist("MyPlayList");
            MediaPlayerControl.currentPlaylist = playlist;

            NPlist = null;

            MyPlaylists    = playlists.getInstance();
            MyPlaylistData = PlaylistData.getInstance();
            if (MyPlaylists.getPlaylistNames() != null)
            {
                foreach (String filename in MyPlaylists.getPlaylistNames())
                {
                    PLlistBox.Items.Add(filename);
                }
            }
            if (file.Length > 0)
            {
                NPlist = file;
                foreach (String listItem in file)
                {
                    string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                    value = "    " + value;
                    NPlistbox.Items.Add(value);
                    media = MediaPlayerControl.newMedia(listItem);
                    playlist.appendItem(media);
                }
                MediaPlayerControl.Ctlcontrols.play();
                NPlistbox.SelectedIndex = 0;
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            player          = new MediaPlayerControl(VV);
            player.OnError += Player_OnError;
        }
Example #5
0
        public override FrameworkElement GetControl(DataPreviewPluginArgument arg)
        {
            MediaPlayerControl grid = new MediaPlayerControl();

            grid.IsAudioFormat = false;
            grid.DataContext   = arg;
            return(grid);
        }
Example #6
0
        static async Task Main(string[] args)
        {
            MediaPlayerControl mediaPlayer = new MediaPlayerControl(null);
            await mediaPlayer.PlayAsync(new Uri("http://help.visioforge.com/video.mp4"));

            Console.WriteLine("Please press any key to stop.");
            Console.ReadKey();
        }
Example #7
0
        private void addToNowPlaying()
        {
            string selItem = null;

            NPlist = null;
            try
            {
                String[] tempList = new String[NPlistbox.Items.Count];
                int      i        = 0;
                int      count    = playlist.count;

                for (int j = 0; j < count; j++)
                {
                    playlist.removeItem(playlist.get_Item(0));
                }

                NPlistbox.Items.Clear();

                selItem = PLlistBox.SelectedItem.ToString();
                Boolean firstLoopTurn = false;
                foreach (String listItem in MyPlaylistData.getPlaylist(selItem))
                {
                    if (firstLoopTurn)
                    {
                        string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                        value = "    " + value;
                        NPlistbox.Items.Add(value);

                        media = MediaPlayerControl.newMedia(listItem);
                        playlist.appendItem(media);
                    }
                    firstLoopTurn = true;
                }

                NPlist        = new String[MyPlaylistData.getPlaylist(selItem).Length - 1];
                i             = 0;
                firstLoopTurn = true;
                foreach (String listitem in MyPlaylistData.getPlaylist(selItem))
                {
                    if (firstLoopTurn)
                    {
                        firstLoopTurn = false;
                        continue;
                    }
                    NPlist[i] = listitem;
                    i++;
                }

                MediaPlayerControl.Ctlcontrols.play();
                tabControl1.SelectedTab = tabPage1;
                NPlistbox.SelectedIndex = 0;
            }

            catch (Exception ex)
            {
                MessageBox.Show("Unable to Play!\n\n" + ex.Message);
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            edFilenameOrURL.Text = "http://help.visioforge.com/video.mp4";

            Player = new MediaPlayerControl(videoView);
            Player.OnPositionChange += Player_OnPositionChange;
            Player.OnStop           += Player_OnStop;
            Player.OnMediaLoaded    += Player_OnMediaLoaded;
            Player.OnError          += Player_OnError;
        }
Example #9
0
        private async void btStop_Click(object sender, EventArgs e)
        {
            await mediaPlayer?.StopAsync();

            mediaPlayer?.Dispose();
            mediaPlayer = null;

            // clear screen workaround
            pnScreen.RemoveView(videoView);
            pnScreen.AddView(videoView);
        }
Example #10
0
        private void MainPage_OnAppearing(object sender, EventArgs e)
        {
            IsVideoViewInitialized = true;

            _videoView   = this.FindByName <VideoView>("videoView");
            _mediaPlayer = new MediaPlayerControl(_videoView);
            _mediaPlayer.OnMediaLengthChanged += MediaPlayerOnOnMediaLengthChanged;
            _mediaPlayer.OnPositionChange     += MediaPlayerOnOnPositionChange;

            edFilename.Text = _filename;
        }
        public Form1()
        {
            InitializeComponent();

            this._player = new MediaPlayerControl(videoView1);
            this._player.OnPositionChange += Player_OnPositionChange;
            this._player.OnStop           += Player_OnStop;
            this._player.OnMediaLoaded    += Player_OnMediaLoaded;
            this._player.OnError          += Player_OnError;

            this._infoReader = new MediaInfoReader();
        }
        public MainWindow()
        {
            InitializeComponent();

            player = new MediaPlayerControl(VideoView);
            player.OnPositionChange += Player_OnPositionChange;
            player.OnStop           += Player_OnStop;
            player.OnMediaLoaded    += Player_OnMediaLoaded;
            player.OnError          += Player_OnError;

            infoReader = new MediaInfoReader();
        }
Example #13
0
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif

            videoView       = this.FindControl <VideoViewX>("videoView");
            edFilenameOrURL = this.FindControl <TextBox>("edFilenameOrURL");
            gridVideoView   = this.FindControl <Grid>("gridVideoView");
            slSeeking       = this.FindControl <Slider>("slSeeking");
            lbTimestamp     = this.FindControl <Label>("lbTimestamp");

            _mediaPlayer          = new MediaPlayerControl(videoView);
            _mediaPlayer.OnError += MediaPlayer_OnError;
            _mediaPlayer.OnMediaLengthChanged += MediaPlayer_OnMediaLengthChanged;
            _mediaPlayer.OnPositionChange     += MediaPlayer_OnPositionChange;
        }
Example #14
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            isSeeking = false;

            mediaPlayer = new MediaPlayerControl(videoView)
            {
                //EnableHardwareDecoding = true
            };

            mediaPlayer.OnPositionChange += MediaPlayer_OnPositionChange;
            mediaPlayer.OnMediaLoaded    += MediaPlayer_OnMediaLoaded;

            //var name = $"textlogo1";
            //var effect = new TextOverlay(name, "TEST", 20, 20);

            //mediaPlayer.Video_Overlays_Add(effect);

            await mediaPlayer.PlayAsync(new Uri(edURL.Text));
        }
Example #15
0
        public IEnumerable <Inline> ParseLine(string[] lines)
        {
            var uriParser = new ImageUriParser();

            foreach (var line in lines)
            {
                var uri = uriParser.TryParse(line);
                if (uri == null)
                {
                    continue;
                }

                var player = new MediaPlayerControl
                {
                    IsAutoPlay  = this.isAutoPlay,
                    DisplayName = uri.Name ?? string.Empty
                };
                player.SetSource(uri.Uri);
                yield return(new InlineUIContainer(player));
            }
        }
        private void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            Player = new MediaPlayerControl(videoView);
            Player.OnPositionChange += Player_OnPositionChange;
            Player.OnStop           += Player_OnStop;
            Player.OnMediaLoaded    += Player_OnMediaLoaded;
            Player.OnError          += Player_OnError;

            InfoReader = new MediaInfoReader();

            AudioOutputPage.AudioOutputDevice.Items?.Clear();
            foreach (var device in Player.Audio_OutputDevices)
            {
                AudioOutputPage.AudioOutputDevice.Items?.Add(device.Description);
            }

            if (AudioOutputPage.AudioOutputDevice.Items?.Count > 0)
            {
                AudioOutputPage.AudioOutputDevice.SelectedIndex = 0;
            }
        }
		public void NavigateToPlayer(object dataContext)
		{
			var mediaPlayer = new MediaPlayerControl { DataContext = dataContext, PlayOnLoad = true };
			RootFrame.Navigate(mediaPlayer);
			//mediaPlayer.Play();
		}
Example #18
0
        private void OpenFiles()
        {
            using (OpenFileDialog dlgOpenFile = new OpenFileDialog())
            {
                dlgOpenFile.Filter      = "Media Files (*.3gp, *.avi, *.mp4, *.mpg, *.wmv, *.m4a, *.mp3, *.wav, *.wma)|*.3gp;*.avi;*.mp4;*.mpg;*.wmv;*.m4a;*.mp3;*.wav;*.wma";
                dlgOpenFile.Title       = "Please select Media file(s)";
                dlgOpenFile.Multiselect = true;

                // Check the user response
                if (dlgOpenFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        String[] presentList = new String[NPlistbox.Items.Count];
                        int      count       = 0;

                        foreach (String listItem in NPlistbox.Items)
                        {
                            presentList[count] = listItem.Substring(4);
                            count++;
                        }

                        foreach (String listItem in dlgOpenFile.FileNames)
                        {
                            Boolean flag = true;
                            foreach (String item in presentList)
                            {
                                if (listItem.Substring(listItem.LastIndexOf("\\") + 1).Equals(item))
                                {
                                    flag = false;
                                }
                            }
                            if (flag)
                            {
                                string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                                value = "    " + value;
                                NPlistbox.Items.Add(value);
                                media = MediaPlayerControl.newMedia(listItem);
                                playlist.appendItem(media);
                            }
                        }

                        if (NPlist != null)
                        {
                            count       = NPlist.Length;
                            presentList = NPlist;
                            NPlist      = new String[NPlistbox.Items.Count];
                            int i = 0;
                            foreach (String listItem in presentList)
                            {
                                NPlist[i] = listItem;
                                i++;
                            }

                            foreach (String listItem in dlgOpenFile.FileNames)
                            {
                                Boolean flag = true;
                                foreach (String item in NPlist)
                                {
                                    if (listItem.Equals(item))
                                    {
                                        flag = false;
                                    }
                                }

                                if (flag)
                                {
                                    NPlist[count] = listItem;
                                    count++;
                                }
                            }
                        }
                        else
                        {
                            NPlist = dlgOpenFile.FileNames;
                        }

                        if (MediaPlayerControl.playState != (WMPLib.WMPPlayState.wmppsPaused) && MediaPlayerControl.playState != (WMPLib.WMPPlayState.wmppsStopped))
                        {
                            MediaPlayerControl.Ctlcontrols.play();
                        }
                        tabControl1.SelectedTab = tabPage1;
                        NPlistbox.SelectedIndex = 0;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Unable to open File!\n\n" + ex.Message);
                    }
                }
            }
        }