protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Carega o layout "main" na view principal
			SetContentView (Resource.Layout.Main);

			// Pega o botão do recurso de layout e coloca um evento nele
			Button button = FindViewById<Button> (Resource.Id.button);

			vv = FindViewById<VideoView> (Resource.Id.video_view);
			pb = FindViewById<ProgressBar> (Resource.Id.progress_bar);
			MediaController mc = new MediaController(this);
			mp = new MediaPlayer ();

			pb.SetOnTouchListener (this);

			var uri = Android.Net.Uri.Parse ("http://3gpfind.com/vid/load/Movie%20Trailer/Predators(3gpfind.com).3gp");
			vv.SetOnPreparedListener (this);
			vv.SetVideoURI(uri);
			vv.SetMediaController(mc);
			mc.SetMediaPlayer(vv);
			mc.SetAnchorView(vv);

			button.Click += delegate {
				mc.Show();
				if (!ready)
				{
					holder = vv.Holder;
					holder.SetType (SurfaceType.PushBuffers);
					holder.AddCallback(this);
					mp.SetDataSource(this, uri);
					mp.SetOnPreparedListener(this);
					mp.Prepare();
					ready = true;
				}

				mp.Start();
//				vv.Start();

				Toast.MakeText (this, "Video Started", ToastLength.Short).Show ();
			};
		}
        protected override void OnElementChanged(ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged(e);

            var crossVideoPlayerView = Element as CrossVideoPlayerView;

            if ((crossVideoPlayerView != null) && (e.OldElement == null))
            {
                var metrics = Resources.DisplayMetrics;

                crossVideoPlayerView.HeightRequest = metrics.WidthPixels/metrics.Density/crossVideoPlayerView.VideoScale;

                var videoView = new VideoView(Context);

                var uri = Android.Net.Uri.Parse(crossVideoPlayerView.VideoSource);

                videoView.SetVideoURI(uri);

                var mediaController = new MediaController(Context);

                mediaController.SetAnchorView(videoView);

                videoView.SetMediaController(mediaController);

                videoView.Start();

                SetNativeControl(videoView);
            }
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			//Hides action bar
			RequestWindowFeature (WindowFeatures.NoTitle);

			SetContentView (Resource.Layout.activity_videoplayer);

			VideoView videoView = FindViewById<VideoView> (Resource.Id.videoView);
			videoView.Completion += delegate { //Activity sluiten wanneer video afgespeeld is
				this.Finish();
			};

			MediaController mediaController = new MediaController(this);
			mediaController.SetAnchorView (videoView);
			videoView.SetMediaController(mediaController);

			try {
				string pathToVideo = Intent.GetStringExtra ("PathToVideo");

				var uri = Android.Net.Uri.Parse (pathToVideo);

				videoView.SetVideoURI (uri);
				videoView.Start ();
			}
			catch (Exception ex){
				Insights.Report(ex);
				this.RunOnUiThread (new Action (() => { 
					Toast.MakeText (this, "Het openen van de video is mislukt. Probeer het a.u.b. opnieuw.", ToastLength.Long).Show ();
				}));
			}
		}
Esempio n. 4
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.play_audio_layout);

			ActionBar.Title = "Replay consultation";
			ActionBar.SetDisplayShowTitleEnabled (false);
			ActionBar.SetDisplayHomeAsUpEnabled(true);
			ActionBar.SetDisplayShowHomeEnabled (true);

			setHeadingTitle ("Replay consultation");
			constants.currentActivity = this;

			llProgress = FindViewById<LinearLayout> (Resource.Id.llProgressBar);

			string audioFile = "";
			if (this.Intent.Extras != null) {
				if (this.Intent.Extras.ContainsKey (constants.pPathAudioFile)) {
					audioFile = this.Intent.Extras.GetString (constants.pPathAudioFile);
					if (!audioFile.Contains ("api.twilio.com")) {
						audioFile = HttpConstants.BASE_URL + audioFile;
					}
				}
			} else {
				Toast.MakeText (this, GetString(Resource.String.replay_not_exist_notice), ToastLength.Short).Show ();
				Finish ();
			}

			//set the objects
			VideoView Vv = FindViewById<VideoView> (Resource.Id.videoView);
			MediaController mc = new MediaController(this);
			mc.SetAnchorView (Vv);
			global::Android.Net.Uri uri = global::Android.Net.Uri.Parse (audioFile);

			//set video view options
			mc.SetMediaPlayer (Vv);
			Vv.SetMediaController (mc);
			Vv.RequestFocus ();
			//this prevents an error if playing is initiated before buffering
			Vv.PostInvalidateDelayed (100);
			Vv.SetVideoURI (uri);
			Vv.Prepared += (object sender, EventArgs e) => {
				llProgress.Visibility = ViewStates.Gone;
				Vv.ShowContextMenu();
				Vv.Focusable = true;
				Vv.RequestFocus ();
				Vv.Visibility = ViewStates.Visible;
				mc.Show(Vv.Duration);
				mc.Activated = true;
				mc.ShowContextMenu();
				mc.Focusable = true;
				mc.RequestFocus();
			};

			Vv.Start ();
		}
Esempio n. 5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.Inflate(Resource.Layout.fragment_hello_moon, container, false);

            mPlayButton = (Button)v.FindViewById(Resource.Id.hellomoon_playButton);
            mPlayButton.Click += (object sender, EventArgs e) => {
                mPlayer.Play(Activity);
            };

            mStopButton = (Button)v.FindViewById(Resource.Id.hellomoon_stopButton);
            mStopButton.Click += (object sender, EventArgs e) => {
                mPlayer.Stop();
            };

            mPauseButton = (Button)v.FindViewById(Resource.Id.hellomoon_pauseButton);
            mPauseButton.Click += (object sender, EventArgs e) => {
                mPlayer.Pause();
            };

            //			string fileName = "http://johnnygold.com/PigsInAPolka1943.mp4"; //Works from web
            string fileName = "android.resource://" + Activity.PackageName + "/" + Resource.Raw.apollo_17_strollnexus; // Now works from device.

            Activity.Window.SetFormat(Android.Graphics.Format.Translucent);
            mVideoView = (VideoView)v.FindViewById(Resource.Id.videoView);
            MediaController controller = new MediaController(Activity);
            mVideoView.SetMediaController(controller);
            mVideoView.RequestFocus();
            Android.Net.Uri uri = Android.Net.Uri.Parse(fileName);
            mVideoView.SetVideoURI(uri);

            //			mVideoView.Start();

            // Not needed with MediaController
            //			vPlayButton = (Button)v.FindViewById(Resource.Id.hellomoon_vPlayButton);
            //			vPlayButton.Click += (object sender, EventArgs e) => {
            //				mVideoView.Start();
            //				vPauseButton.Enabled = true;
            //			};
            //
            //			vStopButton = (Button)v.FindViewById(Resource.Id.hellomoon_vStopButton);
            //			vStopButton.Click += (object sender, EventArgs e) => {
            //				mVideoView.StopPlayback();
            //				vPauseButton.Enabled = false;
            //				mVideoView.SetVideoURI(Android.Net.Uri.Parse(fileName));
            //			};
            //
            //			vPauseButton = (Button)v.FindViewById(Resource.Id.hellomoon_vPauseButton);
            //			vPauseButton.Click += (object sender, EventArgs e) => {
            //				vPauseButton.Enabled = false;
            //				mVideoView.Pause();
            //			};

            return v;
        }
Esempio n. 6
0
 private void RenderVideo(IGalleryItem item)
 {
     //detector = new GestureDetector(new GestureListener(MainVideoView));
     LayoutRoot.Post(() => SetDimensions(MainVideoView, item));
     MainVideoView.Visibility = ViewStates.Visible;
     MainVideoView.SetVideoURI(global::Android.Net.Uri.Parse(item.Mp4));
     MediaController controller = new MediaController(Context);
     controller.SetAnchorView(MainVideoView);
     controller.SetMediaPlayer(MainVideoView);
     MainVideoView.SetMediaController(controller);
     //MainVideoView.Start();
     //MainVideoView.SeekTo(100);
    // MainVideoView.Touch += MainVideoView_Touch;
     MainVideoView.Prepared += MainVideoView_Prepared;
 }
        private void ButtonClick(string file)
        {
            var uri = Uri.Parse("content://" + ZipFileContentProvider.ContentProviderAuthority + "/" + file);
            this.video.SetVideoURI(uri);
            
            // add the start/pause controls
            var controller = new MediaController(this);
            controller.SetMediaPlayer(this.video);
            this.video.SetMediaController(controller);
            this.video.Prepared += delegate
            {
                // play the video
                this.video.Start();
            };

            this.video.RequestFocus();
        }
        private void PlayVideo(string videoUri)
        {
            var videoView = FindViewById<VideoView>(Resource.Id.MainVideoView);

            var uri = Android.Net.Uri.Parse(videoUri);

            videoView.SetVideoURI(uri);

            // doc : http://code.tutsplus.com/tutorials/streaming-video-in-android-apps--cms-19888
            var mediaController = new MediaController(this);

            mediaController.SetAnchorView(videoView);

            videoView.SetMediaController(mediaController);

            videoView.Start();
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.PlayerSimpleFromCatalog);

			brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.Id.brightcove_video_view);

	        MediaController controller = new MediaController(this);
	        brightcoveVideoView.SetMediaController(controller);

	        // b489a672-c3ba-4765-af8e-7fc876ef06f7
	        // ayINLNrUaYhfX9K0AI6hpqVRUlVXCRysABFpxHS0mT_4fWYoPnD5pA..
	        Catalog catalog = new Catalog("XGuquNMCweRY0D3tt_VUotzuyIASMAzhUS4F8ZIWa_e0cYlKpA4WtQ..");

	        catalog.FindPlaylistByID("2764931905001", new PlaylistListener() );

        return;
		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.PlayerSimpleVideoList);

			BrightcoveVideoView brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.Id.brightcove_video_view);

			List<Video> videoList = new List<Video>();
			videoList.Add(Video.CreateVideo(GetString(Resource.String.video)));
			videoList.Add(Video.CreateVideo(GetString(Resource.String.video)));

			MediaController controller = new MediaController(this);
			//overloads problems
			// 
			brightcoveVideoView.SetMediaController(controller);

			brightcoveVideoView.AddAll(videoList);
			brightcoveVideoView.Start();

			return;
		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.PlayerSimpleWithControls);
            ActionBar.Hide();
			BrightcoveVideoView brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.Id.brightcove_video_view);

	        MediaController controller = new MediaController(this);
	        brightcoveVideoView.SetMediaController(controller);

	        brightcoveVideoView.Add
	        					(
	        						Video.CreateVideo
	        								(
                                            GetString(Resource.String.video), 
	        								BrightcoveSDK.Player.Media.DeliveryType.Mp4
	        								)
	        					);
	        brightcoveVideoView.Start();

		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.PlayerSimpleWithControls);

			BrightcoveVideoView brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.Id.brightcove_video_view);

	        MediaController controller = new MediaController(this);
	        brightcoveVideoView.SetMediaController(controller);

	        brightcoveVideoView.Add
	        					(
	        						Video.CreateVideo
	        								(
	        								"http://solutions.brightcove.com/bcls/assets/videos/Bird_Titmouse.mp4", 
	        								BrightcoveSDK.Player.Media.DeliveryType.Mp4
	        								)
	        					);
	        brightcoveVideoView.Start();

		}
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView (Resource.Layout.PlayerSimpleVideoList);

			BrightcoveVideoView brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.Id.brightcove_video_view);

			List<Video> videoList = new List<Video>();
			videoList.Add(Video.CreateVideo("http://solutions.brightcove.com/bcls/assets/videos/Bird_Titmouse.mp4"));
			videoList.Add(Video.CreateVideo("http://solutions.brightcove.com/bcls/assets/videos/Water-Splashing.mp4"));

			MediaController controller = new MediaController(this);
			//overloads problems
			// 
			brightcoveVideoView.SetMediaController(controller);

			brightcoveVideoView.AddAll(videoList);
			brightcoveVideoView.Start();

			return;
		}
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return null;
                    }

                    MediaController = new MediaController( Rock.Mobile.PlatformSpecific.Android.Core.Context );

                    RelativeLayout view = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    view.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    view.SetBackgroundColor( Android.Graphics.Color.Black );
                    view.SetOnTouchListener( this );

                    VideoPlayer = new VideoView( Activity );
                    VideoPlayer.SetMediaController( MediaController );
                    VideoPlayer.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)VideoPlayer.LayoutParameters ).AddRule( LayoutRules.CenterInParent );

                    ( ( view as RelativeLayout ) ).AddView( VideoPlayer );

                    VideoPlayer.SetOnPreparedListener( this );
                    VideoPlayer.SetOnErrorListener( this );

                    ProgressBar = new ProgressBar( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ProgressBar.Indeterminate = true;
                    ProgressBar.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) );
                    ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)ProgressBar.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    view.AddView( ProgressBar );
                    ProgressBar.BringToFront();

                    ResultView = new UIResultView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), delegate { TryPlayMedia( ); } );

                    return view;
                }
Esempio n. 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetNavigationItemSelectedListener(this);

            BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);

            navigation.SetOnNavigationItemSelectedListener(this);

            AssetManager assets = this.Assets;

            using (StreamReader sr = new StreamReader(assets.Open("special.json")))
            {
                var json = sr.ReadToEnd();
                var rootobject_special = JsonConvert.DeserializeObject <SpecialDefualt.Rootobject>(json);
                special = rootobject_special.special;
            }

            using (StreamReader sr = new StreamReader(assets.Open("perks.json")))
            {
                var json             = sr.ReadToEnd();
                var rootobject_perks = JsonConvert.DeserializeObject <PerksDefualt.Rootobject>(json);
                perks = rootobject_perks.perks;
            }

            using (var writer = new System.IO.StringWriter())
            {
                //count_special
                int c_s = 0;
                foreach (var c in special)
                {
                    var layout_main = FindViewById <LinearLayout>(Resource.Id.add_layout_special);

                    CardView.LayoutParams layout_card_par = new CardView.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    layout_card_par.SetMargins(30, 30, 30, 30);
                    LinearLayout layout_card = new LinearLayout(this)
                    {
                        Orientation      = Android.Widget.Orientation.Vertical,
                        LayoutParameters = layout_card_par
                    };
                    CardView.LayoutParams card_par = new CardView.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    card_par.SetMargins(30, 30, 30, 30);
                    CardView card = new CardView(this)
                    {
                        LayoutParameters = card_par,
                    };
                    card.SetCardBackgroundColor(Android.Graphics.Color.Black);

                    var special_name = new TextView(this)
                    {
                        Text = special[c_s].Info[0].ToString()
                    };
                    special_name.SetTextColor(Android.Graphics.Color.LimeGreen);
                    special_name.SetTextSize(ComplexUnitType.Px, 100);

                    var special_description = new TextView(this)
                    {
                        Text = special[c_s].ToString()
                    };
                    special_description.SetTextColor(Android.Graphics.Color.LimeGreen);

                    LinearLayout.LayoutParams par_layout_buttons = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                    {
                        Gravity = GravityFlags.Right
                    };
                    LinearLayout layout_buttons = new LinearLayout(this)
                    {
                        Orientation      = Android.Widget.Orientation.Horizontal,
                        LayoutParameters = par_layout_buttons
                    };

                    var button1 = new ImageButton(this)
                    {
                        ContentDescription = c_s.ToString()
                    };
                    button1.SetImageResource(Resource.Drawable.arrow_left);
                    button1.SetBackgroundColor(Android.Graphics.Color.LimeGreen);

                    var button2 = new ImageButton(this)
                    {
                    };
                    button2.SetImageResource(Resource.Drawable.arrow_right);
                    button2.SetBackgroundColor(Android.Graphics.Color.LimeGreen);

                    var editText1 = new EditText(this)
                    {
                        Text = special[c_s].Data[0].ToString()
                    };
                    editText1.SetTextColor(Android.Graphics.Color.LimeGreen);

                    layout_card.AddView(special_name);
                    layout_card.AddView(special_description);
                    layout_buttons.AddView(button1);
                    layout_buttons.AddView(editText1);
                    layout_buttons.AddView(button2);
                    layout_card.AddView(layout_buttons);
                    card.AddView(layout_card);
                    layout_main.AddView(card);


                    button1.Click += (o, e) => {
                        var current = Int32.Parse(button1.ContentDescription);
                        if (2 <= Int32.Parse(editText1.Text))
                        {
                            editText1.Text = (Int32.Parse(editText1.Text) - 1).ToString();
                            special[current].assignedPoints -= 1;
                        }
                    };
                    button2.Click += (o, e) => {
                        var current = Int32.Parse(button1.ContentDescription.ToString());
                        if (Int32.Parse(editText1.Text) <= 14)
                        {
                            editText1.Text = (Int32.Parse(editText1.Text) + 1).ToString();
                            special[current].assignedPoints += 1;
                        }
                    };
                    c_s += 1;
                }
            }

            using (var writer = new System.IO.StringWriter())
            {
                //count_perks
                int c_p = 0;

                foreach (var c in perks)
                {
                    var layout_main = FindViewById <LinearLayout>(Resource.Id.add_layout_special);

                    CardView.LayoutParams layout_card_par = new CardView.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    layout_card_par.SetMargins(30, 30, 30, 30);
                    LinearLayout layout_card = new LinearLayout(this)
                    {
                        Orientation      = Android.Widget.Orientation.Vertical,
                        LayoutParameters = layout_card_par
                    };
                    CardView.LayoutParams card_par = new CardView.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    card_par.SetMargins(50, 0, 60, 60);
                    CardView card = new CardView(this)
                    {
                        LayoutParameters = card_par
                    };
                    card.SetCardBackgroundColor(Android.Graphics.Color.Black);

                    var perk_name = new TextView(this)
                    {
                        Text = perks[c_p].Info[0][0].ToString()
                    };
                    perk_name.SetTextColor(Android.Graphics.Color.LimeGreen);
                    perk_name.SetTextSize(ComplexUnitType.Px, 100);

                    var perk_description = new TextView(this)
                    {
                        Text = perks[c_p].Info[1][0].ToString()
                    };
                    perk_description.SetTextColor(Android.Graphics.Color.LimeGreen);

                    LinearLayout.LayoutParams par_layout_buttons = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                    {
                        Gravity = GravityFlags.Right
                    };
                    LinearLayout layout_buttons = new LinearLayout(this)
                    {
                        Orientation      = Android.Widget.Orientation.Horizontal,
                        LayoutParameters = par_layout_buttons
                    };

                    var button1 = new ImageButton(this)
                    {
                        ContentDescription = perks[c_p].Data[1].ToString() + c_p.ToString()
                    };
                    button1.SetImageResource(Resource.Drawable.arrow_left);
                    button1.SetBackgroundColor(Android.Graphics.Color.LimeGreen);

                    var button2 = new ImageButton(this)
                    {
                        ContentDescription = perks[c_p].Data[1].ToString() + c_p.ToString()
                    };
                    button2.SetImageResource(Resource.Drawable.arrow_right);
                    button2.SetBackgroundColor(Android.Graphics.Color.LimeGreen);

                    var editText1 = new EditText(this)
                    {
                        Text = perks[c_p].Data[1].ToString()
                    };
                    editText1.SetTextColor(Android.Graphics.Color.LimeGreen);

                    var layoutParams = FindViewById <LinearLayout>(Resource.Id.add_layout_perks);

                    layout_card.AddView(perk_name);
                    layout_card.AddView(perk_description);
                    layout_buttons.AddView(button1);
                    layout_buttons.AddView(editText1);
                    layout_buttons.AddView(button2);
                    layout_card.AddView(layout_buttons);
                    card.AddView(layout_card);
                    layoutParams.AddView(card);
                    var maxCardLevel = perks[c_p].Data[2];
                    var description  = "";
                    foreach (int desc in perks[c_p].Info[1].ToString())
                    {
                        description += desc;
                    }


                    button1.Click += (o, e) => {
                        //count name and description
                        var count   = Int32.Parse(button1.ContentDescription[0].ToString());
                        var current = Int32.Parse(button1.ContentDescription[1].ToString());
                        if (1 <= Int32.Parse(editText1.Text))
                        {
                            editText1.Text = (Int32.Parse(editText1.Text) - 1).ToString();
                            count         -= 1;
                            try
                            {
                                perk_name.Text                = perks[current].Info[0][count].ToString();
                                perk_description.Text         = perks[current].Info[1][count].ToString();
                                perks[current].assignedLevel -= 1;
                            }
                            catch
                            {
                                perk_name.Text                = perks[current].Info[0][0].ToString();
                                perk_description.Text         = perks[current].Info[1][count].ToString();
                                perks[current].assignedLevel -= 1;
                            }
                            button1.ContentDescription = count.ToString() + current.ToString();
                        }
                    };
                    button2.Click += (o, e) => {
                        //count name and description
                        var count   = Int32.Parse(button1.ContentDescription[0].ToString());
                        var current = Int32.Parse(button1.ContentDescription[1].ToString());
                        if (Int32.Parse(editText1.Text) <= maxCardLevel - 1)
                        {
                            editText1.Text = (Int32.Parse(editText1.Text) + 1).ToString();
                            try
                            {
                                perk_name.Text                = perks[current].Info[0][count].ToString();
                                perk_description.Text         = perks[current].Info[1][count].ToString();
                                perks[current].assignedLevel += 1;
                            }
                            catch
                            {
                                perk_name.Text                = perks[current].Info[0][0].ToString();
                                perk_description.Text         = perks[current].Info[1][count].ToString();
                                perks[current].assignedLevel += 1;
                            }
                            count += 1;
                            button1.ContentDescription = count.ToString() + current.ToString();
                        }
                    };
                    c_p += 1;
                }
            }



            videoView = FindViewById <VideoView>(Resource.Id.videoView1);
            var uri = Android.Net.Uri.Parse("android.resource://" + PackageName + "/" + Resource.Raw.fallout_76_video);

            videoView.SetVideoURI(uri);
            videoView.Visibility = ViewStates.Visible;

            MediaController media_controller = new Android.Widget.MediaController(this);

            //videoView.SetOnPreparedListener(new VideoLoop());
            media_controller.SetMediaPlayer(videoView);

            videoView.SetMediaController(media_controller);
            videoView.RequestFocus();

            var play_button    = FindViewById <Button>(Resource.Id.play_button);
            var pause_button   = FindViewById <Button>(Resource.Id.pause_button);
            var mute_button    = FindViewById <Button>(Resource.Id.mute_button);
            var volume_seekBar = FindViewById <SeekBar>(Resource.Id.seek_bar);

            MediaPlayer player = MediaPlayer.Create(this, Resource.Raw.fallout_76_music);

            play_button.Click += (o, e) =>
            {
                player.Start();
            };
            pause_button.Click += (o, e) =>
            {
                player.Pause();
            };
            mute_button.Click += (o, e) =>
            {
                player.SetVolume(0f, 0f);
            };
            volume_seekBar.ProgressChanged += (o, e) =>
            {
                float vol = (float)(Math.Log(volume_seekBar.Progress) / Math.Log(50));
                player.SetVolume(vol, vol);
            };

            var showPopupMenu = FindViewById <Button>(Resource.Id.popupButton);

            showPopupMenu.Click += (o, e) => {
                RelativeLayout layout_status     = FindViewById <RelativeLayout>(Resource.Id.content_status);
                RelativeLayout layout_splash     = FindViewById <RelativeLayout>(Resource.Id.content_splash);
                RelativeLayout layout_navigation = FindViewById <RelativeLayout>(Resource.Id.content_main);
                layout_splash.Visibility     = ViewStates.Gone;
                layout_status.Visibility     = ViewStates.Visible;
                layout_navigation.Visibility = ViewStates.Visible;
            };

            /*var image_splash = FindViewById<ImageView>(Resource.Id.splash_image);
             * var Image = FindViewById<Image>(Resource.Raw.Fallout_76);
             * image_splash(Image);*/
            Update_status();
        }
Esempio n. 16
0
 private void InitMediaController()
 {
     _mediaController = new MediaController(Context);
     _mediaController.SetMediaPlayer(this);
     _mediaController.SetAnchorView(this);
 }
        public void Init()
        {
			Status = MediaPlayerStatus.Loading;

            if (UseNativeControls)
            {
                var mediaController = new MediaController(((VideoView)RenderSurface).Context);
                mediaController.SetAnchorView(VideoViewCanvas);
                VideoViewCanvas.SetMediaController(mediaController);
            }

            VideoViewCanvas.SetOnCompletionListener(this);
            VideoViewCanvas.SetOnErrorListener(this);
            VideoViewCanvas.SetOnPreparedListener(this);
            VideoViewCanvas.SetOnInfoListener(this);
        }
            public override View OnCreateView(LayoutInflater inflater, ViewGroup container,
											   Bundle savedInstanceState)
            {
                var jsonString = this.Arguments.GetString (VoteVidoeTypeFragment_KEY);
                var vote = Newtonsoft.Json.JsonConvert.DeserializeObject<Vote> (jsonString);

                View rootView = inflater.Inflate (Resource.Layout.votedescview_type02, container, false);

                MediaController mc = new MediaController (Activity);

                _videoView = rootView.FindViewById<VideoView> (Resource.Id.votedescview_type02_player);

                _videoView.Prepared += (sender, e) => {
                    _videoView.Start ();
                };

                var uri = Android.Net.Uri.Parse (vote.VideoUrl);
                _videoView.SetVideoURI (uri);
                _videoView.SetMediaController (mc);

                var textView = rootView.FindViewById<TextView> (Resource.Id.votedescview_type02_lbDesc);

                textView.Text = vote.Description;

                return rootView;
            }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.player_activity);
            var root = FindViewById(Resource.Id.root);

            root.Touch += (sender, args) =>
            {
                var motionEvent = args.Event;
                switch (motionEvent.Action)
                {
                    case MotionEventActions.Down:
                        ToggleControlsVisibility();
                        break;
                    case MotionEventActions.Up:
                        ((View) sender).PerformClick();
                        break;
                }
                args.Handled = true;
            };
            root.KeyPress += (sender, args) =>
            {
                var keyCode = args.KeyCode;
                if (keyCode == Keycode.Back || keyCode == Keycode.Escape
                    || keyCode == Keycode.Menu)
                {
                    args.Handled = false;
                }
                else
                {
                    _mediaController.DispatchKeyEvent(args.Event);
                }
            };

            _shutterView = FindViewById(Resource.Id.shutter);
            _debugRootView = FindViewById(Resource.Id.controls_root);

            _videoFrame = FindViewById<AspectRatioFrameLayout>(Resource.Id.video_frame);
            _surfaceView = FindViewById<SurfaceView>(Resource.Id.surface_view);
            _surfaceView.Holder.AddCallback(this);
            _debugTextView = FindViewById<TextView>(Resource.Id.debug_text_view);

            _playerStateTextView = FindViewById<TextView>(Resource.Id.player_state_view);
            _subtitleLayout = FindViewById<SubtitleLayout>(Resource.Id.subtitles);

            _mediaController = new MediaController(this);
            _mediaController.SetAnchorView(root);
            _retryButton = FindViewById<Button>(Resource.Id.retry_button);
            _retryButton.SetOnClickListener(this);
            _videoButton = FindViewById<Button>(Resource.Id.video_controls);
            _audioButton = FindViewById<Button>(Resource.Id.audio_controls);
            _textButton = FindViewById<Button>(Resource.Id.text_controls);

            var currentHandler = CookieHandler.Default;
            if (currentHandler != DefaultCookieManager)
            {
                CookieHandler.Default = DefaultCookieManager;
            }

            _audioCapabilitiesReceiver = new AudioCapabilitiesReceiver(this, this);
            _audioCapabilitiesReceiver.Register();
        }
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return null;
                    }

                    RelativeLayout view = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    view.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    view.SetBackgroundColor( Android.Graphics.Color.Black );
                    view.SetOnTouchListener( this );

                    ProgressBar = new ProgressBar( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ProgressBar.Indeterminate = true;
                    ProgressBar.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) );
                    ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)ProgressBar.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    view.AddView( ProgressBar );

                    // setup our media controller for viewing the position of media
                    MediaController = new MediaController( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    MediaController.SetAnchorView( view );

                    ResultView = new UIResultView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), 
                        delegate 
                        { 
                            // we know we're bound, so now just retry.
                            ResultView.Hide( );
                            PlayerState = MediaPlayerState.Preparing; 
                            StartAudio( );
                            SyncUI( );
                        });

                    return view;
                }