Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Add the player to our UIView's Sub View
            player = new YouTubePlayer(MyPlayer.Bounds);
            MyPlayer.AddSubview(player.PlayerView);

            Dictionary <string, object> playerVars = new Dictionary <string, object> {
                { "controls", 1 },
                { "playsinline", 1 },
                { "autohide", 0 },
                { "showinfo", 1 },
                { "modestbranding", 0 }
            };

            player.LoadWithPlaylistId("PLM75ZaNQS_Fa-rPUZPdK9EejObe-AkkGz", playerVars);
            player.PlayerStateChanged += (object sender, PlayerState e) => {
                PlayerStatus.Text = e.ToString();
            };

//			player.PlayerReceivedError += (object sender, PlayerError e) => new UIAlertView ("Error", e.ToString (), null, "Ok").Show ();

            PlayButton.TouchUpInside += (sender, e) => player.PlayVideo();

            SeekToButton.TouchUpInside += (sender, e) => player.SeekTo(double.Parse(SeekToText.Text), true);

            StopButton.TouchUpInside  += (sender, e) => player.StopVideo();
            PauseButton.TouchUpInside += (sender, e) => player.PauseVideo();

            PlayListIdButton.TouchUpInside += (sender, e) => {
                playerVars = new Dictionary <string, object> {
                    { "controls", 1 },
                    { "playsinline", 1 },
                    { "autohide", 0 },
                    { "showinfo", 1 },
                    { "modestbranding", 0 }
                };
                player.LoadWithPlaylistId(TextPlayListId.Text, playerVars);
            };


            // Perform any additional setup after loading the view, typically from a nib.
        }