Radio Streaming Android

DiegoPDiegoP ITMember
edited April 2017 in Xamarin.Android

Hello, I am new in App development. I would like to create a simple application of Radio Streaming. By collecting some ideas I wrote a few lines of code, and executing the application on the simulator do not get any error, but can not hear anything ..... Can anyone give me some ideas ... the radio URL is indicated in the code. Thank you so much for those who help

using Android.App;
using Android.Widget;
using Android.OS;
using Android.Media;
using System;


namespace radioStreaming
{
    [Activity(Label = "radioStreaming", MainLauncher = true, Icon = "@mipmap/icon")]
    public class MainActivity : Activity
    {
        MediaPlayer player;

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

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

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

            button.Click += delegate { 
                this.player = new MediaPlayer();
                //this.player.SetDataSource("http://www.radiovaredoweb.it/");
                this.player.SetDataSource("http://www.radiovaredoweb.it/radiovaredowebplayer/");
                this.player.SetAudioStreamType(Stream.Music);
                this.player.PrepareAsync();
                this.player.Start();            
            };
        }
    }
}  
Tagged:
Sign In or Register to comment.