Exemplo n.º 1
0
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            if(mLibVLC == null)
            {
                mLibVLC = new LibVLCLibVLC();
                mMediaPlayer = new MediaPlayer(mLibVLC);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format ("{0} clicks!", count++);

                var m = new MediaLibVLC(mLibVLC, Android.Net.Uri.Parse("http://www.montemagno.com/sample.mp3"));

                // Tell the media player to play the new Media.
                mMediaPlayer.Media = m;

                // Finally, play it!
                mMediaPlayer.Play();
            };
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            if (mLibVLC == null)
            {
                mLibVLC      = new LibVLCLibVLC(this);
                mMediaPlayer = new MediaPlayer(mLibVLC);
            }

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button> (Resource.Id.myButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++);

                var m = new MediaLibVLC(mLibVLC, Android.Net.Uri.Parse("http://www.montemagno.com/sample.mp3"));

                // Tell the media player to play the new Media.
                mMediaPlayer.Media = m;

                // Finally, play it!
                mMediaPlayer.Play();
            };
        }
        public async void Play()
        {
            if (mLibVLC == null)
            {
                mLibVLC      = new LibVLCLibVLC(Android.App.Application.Context);
                mMediaPlayer = new MediaPlayer(mLibVLC);
            }
            var streamUri = Preferences.Get("streamUri", string.Empty);

            m = new MediaLibVLC(mLibVLC, Android.Net.Uri.Parse(streamUri));

            // Tell the media player to play the new Media.
            mMediaPlayer.Media = m;

            if (mMediaPlayer.IsPlaying == false)
            {
                // Finally, play it!
                mMediaPlayer.Play();
            }
        }