Beispiel #1
0
        public override void Finish()
        {
            detenedor = false;

            clientesillo.Client.Disconnect(false);

            /*  if (linkactual.Trim() != "")
             * {
             *    mainmenu_Offline.gettearinstancia().reproducir(downloadurlmp3);
             * }
             * else
             * {
             *
             * }*/

            if (Clouding_service.gettearinstancia().musicaplayer.IsPlaying)
            {
                mainmenu_Offline.gettearinstancia().RunOnUiThread(() =>
                {
                    mainmenu_Offline.gettearinstancia().play.SetBackgroundResource(Resource.Drawable.pausebutton2);
                });
            }
            mainmenu_Offline.gettearinstancia().envideo = false;

            clasesettings.recogerbasura();
            Clouding_service.gettearinstancia().musicaplayer.SetDisplay(null);

            base.Finish();
        }
Beispiel #2
0
        public void reproducir(string downloadurl)
        {
            musicaplayer.Reset();


            musicaplayer = Android.Media.MediaPlayer.Create(this, Android.Net.Uri.Parse(downloadurl));

#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            musicaplayer.SetAudioStreamType(Android.Media.Stream.Music);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            musicaplayer.Start();
            ///  musicaplayer.Start();
            ///
            if (estabareproduciendo)
            {
                if (Clouding_service.gettearinstancia() != null)
                {
                    Clouding_service.gettearinstancia().musicaplayer.Pause();
                }
                else
                if (Clouding_serviceoffline.gettearinstancia() != null)
                {
                    Clouding_serviceoffline.gettearinstancia().musicaplayer.Pause();
                }
            }
            playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
            musicaplayer.Completion += delegate
            {
                playpause.SetBackgroundResource(Resource.Drawable.playbutton2);
                barra.Progress = 0;
            };
            playerseteado = true;
        }
 public override void OnCreate()
 {
     if (YoutubePlayerServerActivity.gettearinstancia() != null)
     {
         YoutubePlayerServerActivity.gettearinstancia().videoSurfaceHolder.AddCallback(YoutubePlayerServerActivity.gettearinstancia());
     }
     audioManager = (AudioManager)GetSystemService(AudioService);
     instance     = this;
     base.OnCreate();
 }
Beispiel #4
0
 public void ponerporciento()
 {
     while (detenedor)
     {
         if (Clouding_service.gettearinstancia().musicaplayer.IsPlaying)
         {
             RunOnUiThread(() => {
                 barraprogreso.Max      = Convert.ToInt32(Clouding_service.gettearinstancia().musicaplayer.Duration);
                 barraprogreso.Progress = Convert.ToInt32(Clouding_service.gettearinstancia().musicaplayer.CurrentPosition);
             });
         }
         Thread.Sleep(1000);
     }
 }
Beispiel #5
0
        public override void Finish()
        {
            base.Finish();
            musicaplayer.Reset();
            detenedor = false;

            if (estabareproduciendo)
            {
                if (Clouding_service.gettearinstancia() != null)
                {
                    Clouding_service.gettearinstancia().musicaplayer.Start();
                }
                else
                if (Clouding_serviceoffline.gettearinstancia() != null)
                {
                    Clouding_serviceoffline.gettearinstancia().musicaplayer.Start();
                }
            }


            MultiHelper.ExecuteGarbageCollection();
        }
Beispiel #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.layoutinfooffline);
            //////////////////////////////////////mapeo
            var nombre = FindViewById <TextView>(Resource.Id.textView3);

            link = FindViewById <LinearLayout>(Resource.Id.boton2);
            var foto = FindViewById <ImageView>(Resource.Id.imageView2);

            fondo = FindViewById <ImageView>(Resource.Id.imageView10);
            var cerrar = FindViewById <ImageView>(Resource.Id.imageView1);

            playpause = FindViewById <ImageView>(Resource.Id.imageView3);
            barra     = FindViewById <SeekBar>(Resource.Id.seekBar1);
            var botoncarpeta = FindViewById <LinearLayout>(Resource.Id.boton1);

            //  var reproducirext = FindViewById<ImageView>(Resource.Id.imageView11);

            ///////////////////////////////////////////////////////
            this.SetFinishOnTouchOutside(true);
            nombre.Text     = Intent.GetStringExtra("nombre");
            linkvid         = Intent.GetStringExtra("link");
            nombre.Selected = true;
            link.Selected   = true;



            if (Clouding_service.gettearinstancia() != null)
            {
                estabareproduciendo = Clouding_service.gettearinstancia().musicaplayer.IsPlaying;
            }
            else
            if (Clouding_serviceoffline.gettearinstancia() != null)
            {
                estabareproduciendo = Clouding_serviceoffline.gettearinstancia().musicaplayer.IsPlaying;
            }

            /*
             *          if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBeanMr1)
             *          {
             *
             *              fondo.SetImageBitmap(CreateBlurredImage(20, link.Text));
             *          }
             *
             */


            playpause.SetBackgroundResource(Resource.Drawable.playbutton2);
            using (var imagen = BitmapFactory.DecodeFile(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/portraits/" + linkvid.Split('=')[1]))
            {
                foto.SetImageBitmap(getRoundedShape(imagen));
            }

            animar5(foto);
            new Thread(() =>
            {
                ponerporciento();
            }).Start();

            //////////////////////////////////////clicks
            barra.ProgressChanged += (aass, asda) =>
            {
                if (asda.FromUser)
                {
                    musicaplayer.SeekTo(asda.Progress);
                }
            };
            link.Click += delegate
            {
                var uri    = Android.Net.Uri.Parse(linkvid);
                var intent = new Intent(Intent.ActionView, uri);
                StartActivity(intent);
            };
            botoncarpeta.Click += delegate
            {
                string path = Intent.GetStringExtra("path");

                // Verify the intent will resolve to at least one activity if (intent.resolveActivity(getPackageManager()) != null) { startActivity(chooser); }



                Intent intentssdd = new Intent(Intent.ActionView);
                intentssdd.SetDataAndType(Android.Net.Uri.Parse(path), "resource/folder");
                Intent chooser = Intent.CreateChooser(intentssdd, "tumama");

                if (intentssdd.ResolveActivityInfo(PackageManager, 0) != null)
                {
                    StartActivity(chooser);
                }
                else
                {
                    Toast.MakeText(this, "No hay explorador de archivos valido en su sistema android", ToastLength.Long).Show();
                }
            };

            cerrar.Click += delegate
            {
                this.Finish();
            };
            playpause.Click += delegate
            {
                if (playerseteado)
                {
                    if (musicaplayer.IsPlaying)
                    {
                        playpause.SetBackgroundResource(Resource.Drawable.playbutton2);
                        musicaplayer.Pause();
                        if (estabareproduciendo)
                        {
                            if (Clouding_service.gettearinstancia() != null)
                            {
                                Clouding_service.gettearinstancia().musicaplayer.Start();
                            }
                            else
                            if (Clouding_serviceoffline.gettearinstancia() != null)
                            {
                                Clouding_serviceoffline.gettearinstancia().musicaplayer.Start();
                            }
                        }
                    }
                    else
                    {
                        playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
                        musicaplayer.Start();

                        if (estabareproduciendo)
                        {
                            if (Clouding_service.gettearinstancia() != null)
                            {
                                Clouding_service.gettearinstancia().musicaplayer.Pause();
                            }
                            else
                            if (Clouding_serviceoffline.gettearinstancia() != null)
                            {
                                Clouding_serviceoffline.gettearinstancia().musicaplayer.Pause();
                            }
                        }
                    }
                }
                else
                {
                    reproducir(Intent.GetStringExtra("path"));
                }
            };

            // Create your application here
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.menuvolumen);
            bajo  = FindViewById <ImageView>(Resource.Id.imageView1);
            medio = FindViewById <ImageView>(Resource.Id.imageView2);
            alto  = FindViewById <ImageView>(Resource.Id.imageView3);
            fondo = FindViewById <LinearLayout>(Resource.Id.fondo1);
            fondo.SetBackgroundColor(Color.ParseColor("#2b2e30"));
            string ip = Intent.GetStringExtra("ipadre");

            this.SetFinishOnTouchOutside(true);

            ////////////////////////////////////////clicks//////////////
            bajo.Click += delegate
            {
                animar(bajo);

                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.UTF8.GetBytes("vol0()"));
                }
                else
                if (Clouding_service.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().volumenactual = 0;
                    Clouding_service.gettearinstancia().musicaplayer.SetVolume(0f, 0f);
                    YoutubePlayerServerActivity.gettearinstancia().imgSlideDownAction.SetBackgroundResource(Resource.Drawable.volumelowrojo);
                }

                this.Finish();
                ;
            };
            medio.Click += delegate
            {
                animar(medio);
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.UTF8.GetBytes("vol50()"));
                }
                else
                if (Clouding_service.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().volumenactual = 50;
                    Clouding_service.gettearinstancia().musicaplayer.SetVolume(0.5f, 0.5f);
                    YoutubePlayerServerActivity.gettearinstancia().imgSlideDownAction.SetBackgroundResource(Resource.Drawable.volumemediumrojo);
                }
                this.Finish();
            };
            alto.Click += delegate
            {
                animar(alto);
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.UTF8.GetBytes("vol100()"));
                }
                else
                if (Clouding_service.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().volumenactual = 100;
                    Clouding_service.gettearinstancia().musicaplayer.SetVolume(1f, 1f);
                    YoutubePlayerServerActivity.gettearinstancia().imgSlideDownAction.SetBackgroundResource(Resource.Drawable.volumehighrojo);
                }

                this.Finish();
            };
        }
        public override void OnReceive(Context context, Intent intent)
        {
            if (playeroffline.gettearinstancia() != null || YoutubePlayerServerActivity.gettearinstancia() != null || Mainmenu.gettearinstancia() != null)
            {
                if (intent.Action != Intent.ActionMediaButton && intent.Action != AudioManager.ActionAudioBecomingNoisy)
                {
                    return;
                }
                else
                {
                    if (intent.Action == Intent.ActionMediaButton)
                    {
                        var keyEvent = (KeyEvent)intent.GetParcelableExtra(Intent.ExtraKeyEvent);



                        if (keyEvent.Action == KeyEventActions.Down)
                        {
                            switch (keyEvent.KeyCode)
                            {
                            case Android.Views.Keycode.Headsethook:



                                if (playeroffline.gettearinstancia() != null)
                                {
                                    Android.OS.Handler mHandler = new Android.OS.Handler();
                                    mHandler.PostDelayed(new Action(() => { playeroffline.gettearinstancia().counter = 0; }), 500);

                                    playeroffline.gettearinstancia().millis = SystemClock.CurrentThreadTimeMillis();



                                    if (playeroffline.gettearinstancia().counter < 1)
                                    {
                                        playeroffline.gettearinstancia().counter++;

                                        playeroffline.gettearinstancia().RunOnUiThread(() =>
                                        {
                                            playeroffline.gettearinstancia().playpause.CallOnClick();
                                        });
                                    }
                                    else
                                    {
                                        playeroffline.gettearinstancia().counter = 0;
                                        playeroffline.gettearinstancia().RunOnUiThread(() =>
                                        {
                                            playeroffline.gettearinstancia().siguiente.CallOnClick();
                                        });
                                    }
                                }
                                else
                                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                                {
                                    Android.OS.Handler mHandler = new Android.OS.Handler();
                                    mHandler.PostDelayed(new Action(() => { YoutubePlayerServerActivity.gettearinstancia().counter = 0; }), 500);

                                    YoutubePlayerServerActivity.gettearinstancia().millis = SystemClock.CurrentThreadTimeMillis();



                                    if (YoutubePlayerServerActivity.gettearinstancia().counter < 1)
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().counter++;

                                        YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                        {
                                            YoutubePlayerServerActivity.gettearinstancia().imgPlay.CallOnClick();
                                        });
                                    }
                                    else
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().counter = 0;
                                        YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                        {
                                            YoutubePlayerServerActivity.gettearinstancia().imgNext.CallOnClick();
                                        });
                                    }
                                }


                                break;

                            case Keycode.MediaPlayPause:
                                if (playeroffline.gettearinstancia() != null)
                                {
                                    playeroffline.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        playeroffline.gettearinstancia().playpause.CallOnClick();
                                    });
                                }
                                else
                                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                                {
                                    YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().imgPlay.CallOnClick();
                                    });
                                }

                                break;

                            case Keycode.MediaNext:
                                if (playeroffline.gettearinstancia() != null)
                                {
                                    playeroffline.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        playeroffline.gettearinstancia().siguiente.CallOnClick();
                                    });
                                }
                                else
                                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                                {
                                    YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().imgNext.CallOnClick();
                                    });
                                }

                                break;

                            case Keycode.MediaPlay:
                                if (playeroffline.gettearinstancia() != null)
                                {
                                    playeroffline.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        playeroffline.gettearinstancia().playpause.CallOnClick();
                                    });
                                }
                                else
                                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                                {
                                    YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().imgPlay.CallOnClick();
                                    });
                                }
                                break;

                            case Keycode.MediaPause:
                                if (playeroffline.gettearinstancia() != null)
                                {
                                    playeroffline.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        playeroffline.gettearinstancia().playpause.CallOnClick();
                                    });
                                }
                                else
                                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                                {
                                    YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().imgPlay.CallOnClick();
                                    });
                                }
                                break;

                            case Keycode.MediaPrevious:
                                if (playeroffline.gettearinstancia() != null)
                                {
                                    playeroffline.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        playeroffline.gettearinstancia().anterior.CallOnClick();
                                    });
                                }
                                else
                                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                                {
                                    YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() =>
                                    {
                                        YoutubePlayerServerActivity.gettearinstancia().imgBack.CallOnClick();
                                    });
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (Clouding_service.gettearinstancia() != null)
                        {
                            if (YoutubePlayerServerActivity.gettearinstancia() != null)
                            {
                                YoutubePlayerServerActivity.gettearinstancia().RunOnUiThread(() => YoutubePlayerServerActivity.gettearinstancia().imgPlay.SetBackgroundResource(Resource.Drawable.playbutton2));
                                Clouding_service.gettearinstancia().musicaplayer.Pause();
                            }
                        }
                        else
                        if (Clouding_serviceoffline.gettearinstancia() != null)
                        {
                            if (playeroffline.gettearinstancia() != null)
                            {
                                playeroffline.gettearinstancia().RunOnUiThread(() => playeroffline.gettearinstancia().playpause.SetBackgroundResource(Resource.Drawable.playbutton2));
                                Clouding_serviceoffline.gettearinstancia().musicaplayer.Pause();
                            }
                        }
                    }
                }
            }
            else
            {
            }
        }
Beispiel #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.layoutvideo);
            instancia    = this;
            linkactual   = Intent.GetStringExtra("link");
            indiceactual = int.Parse(Intent.GetStringExtra("posactual"));
            clientesillo = new TcpClient("localhost", 1024);
            video        = FindViewById <SurfaceView>(Resource.Id.videoView1);
            playpause    = FindViewById <ImageView>(Resource.Id.imageView4);

            siguiente = FindViewById <ImageView>(Resource.Id.imageView3);
            var ll4 = FindViewById <LinearLayout>(Resource.Id.linearLayout9);
            var listviewlistareproduccion = FindViewById <ListView>(Resource.Id.listView5);

            listabuscador = FindViewById <ListView>(Resource.Id.listView2);
            var botonlistareproduccion = FindViewById <ImageView>(Resource.Id.imageView20);

            anterior = FindViewById <ImageView>(Resource.Id.imageView5);
            playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
            var botonmenu           = FindViewById <ImageView>(Resource.Id.imageView7);
            var botonfastsearcher   = FindViewById <ImageView>(Resource.Id.imageView13);
            var terminobuscarrapido = FindViewById <EditText>(Resource.Id.edittext2);
            var botonenfastsearcher = FindViewById <ImageView>(Resource.Id.imageView19);

            listaa        = FindViewById <ListView>(Resource.Id.listView1);
            botonminimize = FindViewById <ImageView>(Resource.Id.botonminimize);

            var activarmenu = FindViewById <ImageView>(Resource.Id.imageView12);

            layoutmenues = FindViewById <LinearLayout>(Resource.Id.linearLayout8);
            var botonyoutube = FindViewById <ImageView>(Resource.Id.imageView11);

            ll1 = FindViewById <LinearLayout>(Resource.Id.linearLayout1);
            var ll3 = FindViewById <LinearLayout>(Resource.Id.laprra);

            textbox   = FindViewById <EditText>(Resource.Id.editText1);
            adelantar = FindViewById <ImageView>(Resource.Id.imageView2);
            var layoutbuscador = FindViewById <LinearLayout>(Resource.Id.linearLayout6);

            atrazar           = FindViewById <ImageView>(Resource.Id.imageView6);
            portada           = FindViewById <ImageView>(Resource.Id.imageView8);
            titulo            = FindViewById <TextView>(Resource.Id.textView1);
            barraprogreso     = FindViewById <SeekBar>(Resource.Id.progressBar1);
            listaa.Visibility = ViewStates.Invisible;
            listviewlistareproduccion.Visibility = ViewStates.Invisible;
            holder = video.Holder;
            holder.AddCallback(this);

            string[] items = Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/");

            titulo.Selected = true;
            playlistas.Clear();

            for (int i = 0; i < items.Length; i++)

            {
                playlistas.Add(System.IO.Path.GetFileNameWithoutExtension(items[i]));
            }
            var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, playlistas);

            var parcelable = listviewlistareproduccion.OnSaveInstanceState();

            listviewlistareproduccion.Adapter = adaptadol;
            listviewlistareproduccion.OnRestoreInstanceState(parcelable);

            ll4.Visibility            = ViewStates.Invisible;
            layoutbuscador.Visibility = ViewStates.Invisible;
            layoutmenues.Visibility   = ViewStates.Invisible;

            ll1.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));
            ll3.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));
            ll4.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));
            layoutmenues.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));
            listviewlistareproduccion.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));
            layoutbuscador.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));
            listaa.SetBackgroundColor(Android.Graphics.Color.ParseColor("#323538"));

            mainmenu_Offline.gettearinstancia().envideo = true;
            botonminimize.Visibility = ViewStates.Gone;
            if (linkactual.Trim().Length > 1)
            {
                new Thread(() =>
                {
                    buscaryreproducir();
                }).Start();
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                dialogoprogreso = new ProgressDialog(this);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                dialogoprogreso.SetCanceledOnTouchOutside(false);
                dialogoprogreso.SetCancelable(false);
                dialogoprogreso.SetTitle("Cargando...");
                dialogoprogreso.SetMessage("Por favor espere");
                dialogoprogreso.Show();
            }
            else
            {
                primeravez = false;
            }

            ll1.BringToFront();

            ll1.BringToFront();

            ll1.BringToFront();


            Thread proces = new Thread(new ThreadStart(cargardesdecache));
            proces.Start();

            layoutbuscador.Click += delegate
            {
            };

            layoutmenues.Click += delegate
            {
            };
            ll4.Click += delegate
            {
            };
            ll1.Click += delegate
            {
            };
            ll3.Click += delegate
            {
            };

            textbox.KeyPress += (aaxx, e) =>
            {
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    // Code executed when the enter key is pressed down

                    if (buscando == false)
                    {
                        clasesettings.recogerbasura();
                        Thread process = new Thread(new ThreadStart(buscar));
                        process.Start();
                    }
                }
                else
                {
                    e.Handled = false;
                }
            };

            listviewlistareproduccion.ItemClick += (delegado, aasdsa) =>
            {
                if (playlistas.Count > 0)
                {
                    if (File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + playlistas[aasdsa.Position]).Split('$')[0].Split(';').ToList().Count >= 1 && File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + playlistas[aasdsa.Position]).Split('$')[0].Split(';')[0].Trim() != "")
                    {
                        Intent internado = new Intent(this, typeof(Reproducirlistadialog));
                        internado.PutExtra("ip", "localhost");
                        internado.PutExtra("nombrelista", playlistas[aasdsa.Position]);
                        internado.PutExtra("index", aasdsa.Position.ToString());
                        StartActivity(internado);
                    }
                    else
                    {
                        Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                    }
                }
            };
            botonlistareproduccion.Click += delegate
            {
                animar(botonlistareproduccion);
                if (listviewlistareproduccion.Visibility == ViewStates.Visible)
                {
                    listviewlistareproduccion.Visibility = ViewStates.Invisible;
                }
                else
                {
                    listviewlistareproduccion.BringToFront();
                    listviewlistareproduccion.Visibility = ViewStates.Visible;
                    ll4.Visibility            = ViewStates.Invisible;
                    listaa.Visibility         = ViewStates.Invisible;
                    layoutbuscador.Visibility = ViewStates.Invisible;
                    animar2(listviewlistareproduccion);
                }
            };

            botonenfastsearcher.Click += delegate
            {
                animar(botonenfastsearcher);

                termino = terminobuscarrapido.Text;
                new Thread(() => { buscaryabrir(); }).Start();
                Toast.MakeText(this, "Buscando resultados...", ToastLength.Long).Show();
            };


            botonfastsearcher.Click += delegate
            {
                animar(botonfastsearcher);
                if (ll4.Visibility == ViewStates.Visible)
                {
                    ll4.Visibility = ViewStates.Invisible;
                }
                else
                {
                    ll4.Visibility                       = ViewStates.Visible;
                    listaa.Visibility                    = ViewStates.Invisible;
                    layoutbuscador.Visibility            = ViewStates.Invisible;
                    listviewlistareproduccion.Visibility = ViewStates.Invisible;
                    animar2(ll4);
                }
            };


            listabuscador.ItemClick += (easter, sender) =>
            {
                if (linkeses.Count > 0)
                {
                    if (sender.Position >= 0)
                    {
                        Intent intentar = new Intent(this, typeof(customdialogact));

                        intentar.PutExtra("ipadress", "localhost");

                        intentar.PutExtra("imagen", @"https://i.ytimg.com/vi/" + linkeses[sender.Position].Split('=')[1] + "/hqdefault.jpg");
                        intentar.PutExtra("url", linkeses[sender.Position]);
                        intentar.PutExtra("titulo", nombreses[sender.Position]);
                        intentar.PutExtra("color", "DarkGray");
                        StartActivity(intentar);
                    }
                }
            };

            Clouding_service.gettearinstancia().musicaplayer.Completion += delegate
            {
                if (this != null)
                {
                    playpause.SetBackgroundResource(Resource.Drawable.playbutton2);
                }

                mainmenu_Offline.gettearinstancia().siguiente();
                ///  clientesillo.Client.Send(Encoding.Default.GetBytes("next()"));
            };

            Thread proc = new Thread(new ThreadStart(ponerporciento));
            proc.Start();
            Thread proc2 = new Thread(new ThreadStart(receptor));
            proc2.Start();
            activarmenu.Click += delegate
            {
                animar(activarmenu);
                if (layoutmenues.Visibility == ViewStates.Visible)
                {
                    menuabierto = false;
                    layoutbuscador.Visibility = ViewStates.Invisible;
                    listaa.Visibility         = ViewStates.Invisible;
                    animar7(layoutmenues);
                    ll4.Visibility = ViewStates.Invisible;
                    listviewlistareproduccion.Visibility = ViewStates.Invisible;
                }
                else
                {
                    menuabierto             = true;
                    layoutmenues.Visibility = ViewStates.Visible;
                    animar3(layoutmenues);
                }
            };

            botonyoutube.Click += delegate
            {
                animar(botonyoutube);
                if (layoutbuscador.Visibility == ViewStates.Visible)
                {
                    layoutbuscador.Visibility = ViewStates.Invisible;
                }
                else
                {
                    listviewlistareproduccion.Visibility = ViewStates.Invisible;
                    ll4.Visibility            = ViewStates.Invisible;
                    listaa.Visibility         = ViewStates.Invisible;
                    layoutbuscador.Visibility = ViewStates.Visible;
                    animar2(layoutbuscador);
                }
            };
            listaa.ItemClick += (sender, easter) =>
            {
                if (lapara.Count > 0)
                {
                    Intent intentoo = new Intent(this, typeof(deletedialogact));

                    intentoo.PutExtra("index", easter.Position.ToString());
                    intentoo.PutExtra("color", "DarkGray");
                    intentoo.PutExtra("titulo", lapara[easter.Position]);
                    intentoo.PutExtra("ipadress", "localhost");
                    intentoo.PutExtra("url", laparalink[easter.Position]);
                    intentoo.PutExtra("imagen", @"https://i.ytimg.com/vi/" + laparalink[easter.Position].Split('=')[1] + "/hqdefault.jpg");
                    StartActivity(intentoo);
                }
            };
            botonminimize.Click += delegate
            {
                if (menuabierto)
                {
                    layoutmenues.Visibility = ViewStates.Visible;
                }
                else
                {
                    layoutmenues.Visibility = ViewStates.Invisible;
                }
                botonminimize.Visibility = ViewStates.Gone;
                ll1.Visibility           = ViewStates.Visible;
                ll3.Visibility           = ViewStates.Visible;
                videofullscreen          = false;
            };
            siguiente.Click += delegate
            {
                animar(siguiente);
                clientesillo.Client.Send(Encoding.Default.GetBytes("next()"));
            };
            anterior.Click += delegate
            {
                animar(anterior);
                clientesillo.Client.Send(Encoding.Default.GetBytes("back()"));
            };



            atrazar.Click += delegate
            {
                animar(atrazar);
                Clouding_service.gettearinstancia().musicaplayer.SeekTo(Convert.ToInt32(Clouding_service.gettearinstancia().musicaplayer.CurrentPosition - Clouding_service.gettearinstancia().musicaplayer.Duration * 0.10));
            };
            adelantar.Click += delegate
            {
                animar(adelantar);
                Clouding_service.gettearinstancia().musicaplayer.SeekTo(Convert.ToInt32(Clouding_service.gettearinstancia().musicaplayer.CurrentPosition + Clouding_service.gettearinstancia().musicaplayer.Duration * 0.10));
            };


            botonmenu.Click += delegate
            {
                animar(botonmenu);
                listaa.BringToFront();
                if (listaa.Visibility == ViewStates.Visible)
                {
                    listaa.Visibility = ViewStates.Invisible;
                }
                else
                {
                    listviewlistareproduccion.Visibility = ViewStates.Invisible;
                    ll4.Visibility            = ViewStates.Invisible;
                    layoutbuscador.Visibility = ViewStates.Invisible;
                    listaa.Visibility         = ViewStates.Visible;
                    animar2(listaa);
                }
                listaa.BringToFront();
            };
            barraprogreso.ProgressChanged += (aa, aaaa) =>
            {
                if (aaaa.FromUser)
                {
                    Clouding_service.gettearinstancia().musicaplayer.SeekTo(aaaa.Progress);
                }
            };

            video.Touch += (aa, aaaa) =>
            {
                if (aaaa.Event.Action == MotionEventActions.Up)
                {
                    if (!videofullscreen)
                    {
                        ll1.Visibility = ViewStates.Invisible;
                        listviewlistareproduccion.Visibility = ViewStates.Invisible;
                        ll3.Visibility            = ViewStates.Invisible;
                        layoutbuscador.Visibility = ViewStates.Invisible;
                        listaa.Visibility         = ViewStates.Invisible;
                        layoutmenues.Visibility   = ViewStates.Invisible;
                        ll4.Visibility            = ViewStates.Invisible;
                        botonminimize.Visibility  = ViewStates.Visible;
                        videofullscreen           = true;
                    }
                    else
                    {
                        if (menuabierto)
                        {
                            layoutmenues.Visibility = ViewStates.Visible;
                        }
                        else
                        {
                            layoutmenues.Visibility = ViewStates.Invisible;
                        }
                        botonminimize.Visibility = ViewStates.Gone;
                        ll1.Visibility           = ViewStates.Visible;
                        ll3.Visibility           = ViewStates.Visible;
                        videofullscreen          = false;
                    }
                }
            };

            // Create your application here
            playpause.Click += delegate
            {
                animar(playpause);
                if (Clouding_service.gettearinstancia().musicaplayer.IsPlaying == true)
                {
                    playpause.SetBackgroundResource(Resource.Drawable.playbutton2);

                    Clouding_service.gettearinstancia().musicaplayer.Pause();
                }
                else

                {
                    playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
                    Clouding_service.gettearinstancia().musicaplayer.Start();
                }
            };
        }
Beispiel #10
0
 public void SurfaceDestroyed(ISurfaceHolder holder)
 {
     Clouding_service.gettearinstancia().musicaplayer.SetDisplay(null);
 }
Beispiel #11
0
 public void SurfaceCreated(ISurfaceHolder holder)
 {
     Clouding_service.gettearinstancia().musicaplayer.SetDisplay(holder);
     videoenholder = true;
 }
Beispiel #12
0
        public void buscaryreproducir(bool invoked = false)
        {
            /*
             *       var   videoinfoss = DownloadUrlResolver.GetDownloadUrls(linkactual, false);
             *
             *          VideoInfo video2 = videoinfoss.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 360);
             *          VideoInfo video3 = videoinfoss.First(info => info.VideoType == VideoType.Mp4 && info.Resolution ==0);
             */

            if (!mainmenu_Offline.gettearinstancia().contienevideo || invoked)
            {
                //////////////////////////////////////////////////////cuando no es un video
                var    videito    = Client.For(YouTube.Default);
                var    videoo     = videito.GetAllVideosAsync(linkactual);
                var    resultados = videoo.Result;
                var    title      = resultados.First().Title.Replace("- YouTube", "");
                string video2     = resultados.First(info => info.Resolution == 360 && info.AudioFormat == AudioFormat.Aac).GetUriAsync().Result;

                string video3 = "";
                if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
                {
                    video3 = resultados.First(info => info.Resolution == -1 && info.AudioFormat == AudioFormat.Aac).GetUriAsync().Result;
                }
                else
                {
                    video3 = resultados.First(info => info.Resolution == 240 && info.AudioFormat == AudioFormat.Aac).GetUriAsync().Result;
                }

                //clasesettings.guardarsetting("cquerry", "data()>" + title.Replace('>', ' ') + ">" + linkactual.Replace('>', ' '));
                string imagensilla = "https://i.ytimg.com/vi/" + linkactual.Split('=')[1] + "/mqdefault.jpg";
                var    imgurl      = imagensilla;
                downloadurlmp3 = video3;
                RunOnUiThread(() => portada.SetImageBitmap(GetImageBitmapFromUrl(imagensilla)));

                RunOnUiThread(() => {
                    titulo.Text = title;
                    /// video.SetFitsSystemWindows(true);

                    //Clouding_service.gettearinstancia().musicaplayer.SetVideoURI(Android.Net.Uri.Parse(video2));


                    Clouding_service.gettearinstancia().musicaplayer.Reset();


                    Clouding_service.gettearinstancia().musicaplayer = Android.Media.MediaPlayer.Create(this, Android.Net.Uri.Parse(video2));

#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                    Clouding_service.gettearinstancia().musicaplayer.SetAudioStreamType(Android.Media.Stream.Music);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                    Clouding_service.gettearinstancia().musicaplayer.SetWakeMode(this, WakeLockFlags.Partial);
                    Clouding_service.gettearinstancia().musicaplayer.SetDisplay(null);
                    Clouding_service.gettearinstancia().musicaplayer.SetDisplay(holder);
                    Clouding_service.gettearinstancia().musicaplayer.Prepared += delegate
                    {
                        if (clasesettings.gettearvalor("progresovideoactual") != "")
                        {
                            Clouding_service.gettearinstancia().musicaplayer.SeekTo(int.Parse(clasesettings.gettearvalor("progresovideoactual")));
                            clasesettings.guardarsetting("progresovideoactual", "");
                        }
                    };

                    Clouding_service.gettearinstancia().musicaplayer.Completion += delegate
                    {
                        mainmenu_Offline.gettearinstancia().RunOnUiThread(() =>
                        {
                            mainmenu_Offline.gettearinstancia().adelante.PerformClick();
                        });
                    };
                    Clouding_service.gettearinstancia().musicaplayer.Start();

                    // video.RequestFocus();

                    playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
                    ll1.BringToFront();
                    encontro = true;
                    if (primeravez)
                    {
                        dialogoprogreso.Dismiss();
                        primeravez = false;
                    }
                });
            }
            else
            {
                ////////////////////////////////////////////////////////////////cuando ya es un video de por si :V
                Clouding_service.gettearinstancia().musicaplayer.Prepare();
                RunOnUiThread(() => {
                    mainmenu_Offline.gettearinstancia().RunOnUiThread(() => {
                        titulo.Text = mainmenu_Offline.gettearinstancia().label.Text;
                    });
                    portada.SetImageBitmap(GetImageBitmapFromUrl("https://i.ytimg.com/vi/" + mainmenu_Offline.gettearinstancia().linkactual.Split('=')[1] + "/mqdefault.jpg"));

                    playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
                    /// video.SetFitsSystemWindows(true);

                    //Clouding_service.gettearinstancia().musicaplayer.SetVideoURI(Android.Net.Uri.Parse(video2));



                    Clouding_service.gettearinstancia().musicaplayer.SetDisplay(holder);
                    Clouding_service.gettearinstancia().musicaplayer.Start();

                    /*     Clouding_service.gettearinstancia().musicaplayer.Completion += delegate
                     *   {
                     *       mainmenu_Offline.gettearinstancia().RunOnUiThread(() =>
                     *       {
                     *           mainmenu_Offline.gettearinstancia().adelante.PerformClick();
                     *       });
                     *   };*/
                    //  Clouding_service.gettearinstancia().musicaplayer.Start();

                    // video.RequestFocus();

                    playpause.SetBackgroundResource(Resource.Drawable.pausebutton2);
                    ll1.BringToFront();
                    encontro = true;
                    if (primeravez)
                    {
                        dialogoprogreso.Dismiss();
                        primeravez = false;
                    }
                });
            }
        }
Beispiel #13
0
 public void Onpause()
 {
     Clouding_service.gettearinstancia().musicaplayer.Pause();
     porciento = Clouding_service.gettearinstancia().musicaplayer.CurrentPosition;
     base.OnPause();
 }
Beispiel #14
0
 public void Onresume()
 {
     Clouding_service.gettearinstancia().musicaplayer.SeekTo(porciento);
     base.OnResume();
 }