Ejemplo n.º 1
0
 private void PlatformInitialize(string fileName)
 {
     if (_androidPlayer == null)
     {
         _androidPlayer             = new Android.Media.MediaPlayer();
         _androidPlayer.Completion += new EventHandler(AndroidPlayer_Completion);
     }
 }
Ejemplo n.º 2
0
 internal Song(string fileName)
 {
     _name = fileName;
     if (_androidPlayer == null)
     {
         _androidPlayer = new Android.Media.MediaPlayer();
     }
 }
Ejemplo n.º 3
0
 public void Dispose()
 {
     if (Player != null)
     {
         Player.Dispose();
         Player = null;
     }
 }
Ejemplo n.º 4
0
        private void PlatformDispose(bool disposing)
        {
            if (Player == null)
                return;

            Player.Dispose();
            Player = null;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Instantiates a new SimpleAudioPlayer
 /// </summary>
 public SimpleAudioPlayerImplementation()
 {
     player = new Android.Media.MediaPlayer()
     {
         Looping = Loop
     };
     player.Completion += OnPlaybackEnded;
 }
Ejemplo n.º 6
0
        private async void Play()
        {
            if (string.IsNullOrEmpty(MediaUrl) ||
                _mediaPlayer == null)
            {
                return;
            }

            try
            {
                // Video Support
                if (MediaUrl.EndsWith(".mp4", StringComparison.CurrentCultureIgnoreCase) ||
                    MediaUrl.EndsWith(".f4v", StringComparison.CurrentCultureIgnoreCase) ||
                    MediaUrl.EndsWith(".m4v", StringComparison.CurrentCultureIgnoreCase))
                {
                    _imageView.Visibility = ViewStates.Invisible;

                    if (_popper.IsDebugMode)
                    {
                        AssetFileDescriptor afd = Assets.OpenFd(MediaUrl);
                        await _mediaPlayer.SetDataSourceAsync(afd);
                    }
                    else
                    {
                        await _mediaPlayer.SetDataSourceAsync(MediaUrl);
                    }

                    _mediaPlayer.Looping = true;
                    _mediaPlayer.Prepare();
                }
                // PNG Support
                else if (MediaUrl.EndsWith(".png", StringComparison.CurrentCultureIgnoreCase))
                {
                    _textureView.Visibility = ViewStates.Invisible;
                    _mediaPlayer.Release();
                    _mediaPlayer.Dispose();
                    _mediaPlayer = null;

                    if (_popper.IsDebugMode)
                    {
                        System.IO.Stream ims = Assets.Open(MediaUrl);
                        Drawable         d   = Drawable.CreateFromStream(ims, null);
                        _imageView.SetImageDrawable(d);
                    }
                    else
                    {
                        _imageView.SetImageURI(Android.Net.Uri.FromFile(new Java.IO.File(MediaUrl)));
                    }

                    _loadingSpinner.Visibility = ViewStates.Invisible;
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"Error trying to start media player - {ex.Message}", ex);
            }
        }
Ejemplo n.º 7
0
 public void OnVideoSizeChanged(Android.Media.MediaPlayer mp, int width, int height)
 {
     if (width > 0 && height > 0 && !_videoSizeSetupDone)
     {
         Logger.Debug($"Video size changed: {width} x {height}");
         _loadingSpinner.Visibility = ViewStates.Invisible;
         ChangeVideoSize(width, height);
     }
 }
Ejemplo n.º 8
0
        public bool OnError(Android.Media.MediaPlayer mp, Android.Media.MediaError what, int extra)
        {
            this.ParentElement.HasError     = true;
            this.ParentElement.ErrorMessage = what.ToString();

            this._HasEnded = true;
            // true handle, false allow pass
            return(false);
        }
Ejemplo n.º 9
0
 internal Song(string fileName)
 {
     _name = fileName;
     if (_androidPlayer == null)
     {
         _androidPlayer             = new Android.Media.MediaPlayer();
         _androidPlayer.Completion += new EventHandler(_androidPlayer_Completion);
     }
 }
Ejemplo n.º 10
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     player = Android.Media.MediaPlayer.Create(this, Resource.Raw.SampleAudio);
     SetContentView(Resource.Layout.Main);
     mAudioManager = (AudioManager)GetSystemService(Context.AudioService);
     maxVolume     = mAudioManager.GetStreamMaxVolume(Stream.Music);
     onVolumeChangeListener();
     player.Start();
 }
Ejemplo n.º 11
0
 public void OnVideoSizeChanged(Android.Media.MediaPlayer mp, int width, int height)
 {
     mVideoWidth  = mp.VideoWidth;
     mVideoHeight = mp.VideoHeight;
     if (mVideoWidth != 0 && mVideoHeight != 0)
     {
         Holder.SetFixedSize(mVideoWidth, mVideoHeight);
         RequestLayout();
     }
 }
Ejemplo n.º 12
0
        private void PlatformDispose(bool disposing)
        {
            if (Player == null)
            {
                return;
            }

            Player.Dispose();
            Player = null;
        }
Ejemplo n.º 13
0
        // ===========================================================
        // Methods for/from SuperClass/Interfaces
        // ===========================================================

        // ===========================================================
        // Methods
        // ===========================================================

        public static Music CreateMusicFromFile(MusicManager pMusicManager, Context pContext, File pFile) /* throws IOException */ {
            MediaPlayer mediaPlayer = new MediaPlayer();

            mediaPlayer.SetDataSource(new FileInputStream(pFile).FD);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);
            pMusicManager.Add(music);

            return music;
        }
Ejemplo n.º 14
0
 void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (Player != null)
         {
             Player.Dispose();
             Player = null;
         }
         disposed = true;
     }
 }
Ejemplo n.º 15
0
        public static Music createMusicFromResource(MusicManager pMusicManager, Context pContext, int pMusicResID) /* throws IOException */
        {
            MediaPlayer mediaPlayer = MediaPlayer.Create(pContext, pMusicResID);

            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);

            pMusicManager.Add(music);

            return(music);
        }
Ejemplo n.º 16
0
        // ===========================================================
        // Methods for/from SuperClass/Interfaces
        // ===========================================================

        // ===========================================================
        // Methods
        // ===========================================================

        public static Music CreateMusicFromFile(MusicManager pMusicManager, Context pContext, File pFile) /* throws IOException */
        {
            MediaPlayer mediaPlayer = new MediaPlayer();

            mediaPlayer.SetDataSource(new FileInputStream(pFile).FD);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);

            pMusicManager.Add(music);

            return(music);
        }
Ejemplo n.º 17
0
        private bool ResolveTakedVideoDuration(string videoPath, int durationLimitSeconds)
        {
            Android.Media.MediaPlayer mediaPlayer = Android.Media.MediaPlayer.Create(this, Android.Net.Uri.Parse(videoPath));

            bool result = false;

            if ((mediaPlayer.Duration / 1000) < durationLimitSeconds)
            {
                result = true;
            }

            return(result);
        }
Ejemplo n.º 18
0
 private void PlatformInitialize()
 {
     Player = new Android.Media.MediaPlayer();
     if (Player != null)
     {
         var afd = Game.Activity.Assets.OpenFd(FileName);
         if (afd != null)
         {
             Player.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);
             Player.Prepare();
         }
     }
 }
Ejemplo n.º 19
0
 internal void Prepare()
 {
     Player = new Android.Media.MediaPlayer();
     if (Player != null)
     {
         var fd = Game.contextInstance.Assets.OpenFd(_fileName).FileDescriptor;
         if (fd != null)
         {
             Player.SetDataSource(fd);
             Player.Prepare();
         }
     }
 }
Ejemplo n.º 20
0
        public static Music CreateMusicFromAsset(MusicManager pMusicManager, Context pContext, String pAssetPath) /*throws IOException */ {
            MediaPlayer mediaPlayer = new MediaPlayer();

            //AssetFileDescriptor assetFileDescritor = pContext.getAssets().openFd(MusicFactory.sAssetBasePath + pAssetPath);
            AssetFileDescriptor assetFileDescritor = pContext.Assets.OpenFd(MusicFactory.sAssetBasePath + pAssetPath);
            mediaPlayer.SetDataSource(assetFileDescritor.FileDescriptor, assetFileDescritor.StartOffset, assetFileDescritor.Length);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);
            pMusicManager.Add(music);

            return music;
        }
Ejemplo n.º 21
0
 private void PlatformInitialize()
 {
     Player = new Android.Media.MediaPlayer();
     if (Player != null)
     {
         var afd = AndroidGameActivity.Instance.Assets.OpenFd(FileName);
         if (afd != null)
         {
             Player.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);
             Player.Prepare();
         }
     }
 }
Ejemplo n.º 22
0
 internal void Prepare()
 {
     Player = new Android.Media.MediaPlayer();
     if (Player != null)
     {
         var afd = Game.Activity.Assets.OpenFd(_fileName);
         if (afd != null)
         {
             Player.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);
             Player.Prepare();
         }
     }
 }
Ejemplo n.º 23
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.videolayout);
     // Create your application here
     mediaPlayer = new Android.Media.MediaPlayer();
     SurfaceView surface = (SurfaceView)FindViewById(Resource.Id.surface);
     var holder = surface.Holder;
     holder.AddCallback(this);
     holder.SetType(Android.Views.SurfaceType.PushBuffers);
     Button btnClose = FindViewById<Button>(Resource.Id.btnClose);
     btnClose.Click += new EventHandler(btnClose_Click);
 }
Ejemplo n.º 24
0
		void Play (string filename)
		{
			Android.Media.MediaPlayer _mediaPlayerLong = null;

			var assetsFileDescriptor = Mvx.Resolve<IMvxAndroidCurrentTopActivity> ().Activity.Assets.OpenFd (filename);
			if (assetsFileDescriptor != null) {
				_mediaPlayerLong = new Android.Media.MediaPlayer ();
				_mediaPlayerLong.SetDataSource (assetsFileDescriptor.FileDescriptor, assetsFileDescriptor.StartOffset,
					assetsFileDescriptor.Length);
			}

			_mediaPlayerLong.Prepare ();
			_mediaPlayerLong.Start ();
		}
Ejemplo n.º 25
0
        /// <summary>
        /// Instantiates a new AudioPlayer
        /// </summary>
        public AudioPlayerImplementation()
        {
            player = new Android.Media.MediaPlayer()
            {
                Looping = Loop
            };
            player.Completion += OnPlaybackEnded;
            if (player != null)
            {
                player.TimedText += Player_TimedText;
            }

            player?.SetWakeMode(context, WakeLockFlags.ScreenDim);
        }
Ejemplo n.º 26
0
        private void PlatformDispose(bool disposing)
        {
            lock (_playMutex)
            {
                lock (_playingSongs)
                    _playingSongs.Remove(this);

                if (_androidPlayer != null)
                {
                    _androidPlayer.Dispose();
                    _androidPlayer = null;
                }
            }
        }
Ejemplo n.º 27
0
        public void Prepare(string assetName, HandlePrepare prepareHandler)
        {
            if (mMediaPlayer == null)
            {
                mMediaPlayer = new Android.Media.MediaPlayer();
            }

            AssetFileDescriptor assetFd = Android.App.Application.Context.Assets.OpenFd(assetName);

            mMediaPlayer.Reset();
            mMediaPlayer.SetDataSource(assetFd);
            mMediaPlayer.SetAudioStreamType(ExchangeAudioStreamType(mAudioStreamType));
            mMediaPlayer.Looping = mLoop;
            mMediaPlayer.SetOnPreparedListener(new LocalPrepareListener(prepareHandler));
        }
        ///<Summary>
        /// Load wav or mp3 audio file from the iOS Resources folder
        ///</Summary>
        public bool Load(string fileName)
        {
            DeletePlayer();

            AssetFileDescriptor afd = Android.App.Application.Context.Assets.OpenFd(fileName);

            player = new Android.Media.MediaPlayer()
            {
                Looping = Loop
            };

            player?.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);

            return(PreparePlayer());
        }
Ejemplo n.º 29
0
        void DeletePlayer()
        {
            Stop();

            if (player != null)
            {
                player.Completion -= OnPlaybackEnded;
                player.Release();
                player.Dispose();
                player = null;
            }

            DeleteFile(path);
            path = string.Empty;
        }
Ejemplo n.º 30
0
        void Play(string filename)
        {
            Android.Media.MediaPlayer _mediaPlayerLong = null;

            var assetsFileDescriptor = Mvx.Resolve <IMvxAndroidCurrentTopActivity> ().Activity.Assets.OpenFd(filename);

            if (assetsFileDescriptor != null)
            {
                _mediaPlayerLong = new Android.Media.MediaPlayer();
                _mediaPlayerLong.SetDataSource(assetsFileDescriptor.FileDescriptor, assetsFileDescriptor.StartOffset,
                                               assetsFileDescriptor.Length);
            }

            _mediaPlayerLong.Prepare();
            _mediaPlayerLong.Start();
        }
Ejemplo n.º 31
0
        public static Music CreateMusicFromAsset(MusicManager pMusicManager, Context pContext, String pAssetPath) /*throws IOException */
        {
            MediaPlayer mediaPlayer = new MediaPlayer();

            //AssetFileDescriptor assetFileDescritor = pContext.getAssets().openFd(MusicFactory.sAssetBasePath + pAssetPath);
            AssetFileDescriptor assetFileDescritor = pContext.Assets.OpenFd(MusicFactory.sAssetBasePath + pAssetPath);

            mediaPlayer.SetDataSource(assetFileDescritor.FileDescriptor, assetFileDescritor.StartOffset, assetFileDescritor.Length);
            mediaPlayer.Prepare();

            Music music = new Music(pMusicManager, mediaPlayer);

            pMusicManager.Add(music);

            return(music);
        }
        public bool Load(Stream audioStream)
        {
            //cache to the file system
            var path       = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), $"cache{index++}.wav");
            var fileStream = File.Create(path);

            audioStream.CopyTo(fileStream);
            fileStream.Close();

            //load the cached audio into MediaPlayer
            player?.Dispose();
            player = new Android.Media.MediaPlayer();
            player.SetDataSource(path);
            player.Prepare();

            return(true);
        }
Ejemplo n.º 33
0
        public PlatformSystem(Activity activity)
        {
            m_Activity = activity;
            this.m_ConnectivityManager = (ConnectivityManager)Application.Context.GetSystemService(Context.ConnectivityService);

            //record audios
            timer.Interval = 1000;
            timer.Elapsed += Timer_Elapsed;


            _recorder = new Android.Media.MediaRecorder();
            _player   = new Android.Media.MediaPlayer();

            _player.Completion += (sender, e) => {
                _player.Reset();
            };
        }
Ejemplo n.º 34
0
        protected override void OnStop()
        {
            base.OnStop();

            if (_mediaPlayer != null)
            {
                _mediaPlayer.Stop();
                _mediaPlayer.Error    -= OnMediaPlaybackError;
                _mediaPlayer.Prepared -= OnMediaPlayerPrepared;
                _mediaPlayer.Release();
                _mediaPlayer.Dispose();
                _mediaPlayer = null;
            }

            if (_textureView != null)
            {
                _textureView.SurfaceTextureAvailable -= OnSurfaceTextureAvailable;
            }
        }
Ejemplo n.º 35
0
        public void PlayScreenshot()
        {
            lock (_LOCK_)
            {
                if (mIsEffectsOn == false)
                {
                    return;
                }

                if (mPlayer_SoundEffect_Screenshot == null)
                {
                    // mPlayer_SoundEffect_Screenshot = Android.Media.MediaPlayer.Create((Activity)Xamarin.Forms.Forms.Context, Resource.Raw.screenshot);
                    mPlayer_SoundEffect_Screenshot = Android.Media.MediaPlayer.Create(Xamarin.Essentials.Platform.AppContext, Resource.Raw.screenshot);
                }

                mPlayer_SoundEffect_Screenshot.SetVolume(mEffectsVolume, mEffectsVolume);
                mPlayer_SoundEffect_Screenshot.Start();
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            //Get LayoutInflater and inflate from axml
            //Important note, this project utilizes a layout-land folder in the Resources folder
            //Android will use this folder with layout files for Landscape Orientations
            //This is why we don't have to worry about the layout of the play button, it doesn't exist in landscape layout file!!!
            var activity   = Context as Activity;
            var viewHolder = activity.LayoutInflater.Inflate(Resource.Layout.Main, this, false);

            view = viewHolder;
            AddView(view);

            //Get and set Views
            videoView  = FindViewById <Android.Widget.VideoView> (Resource.Id.SampleVideoView);
            playButton = FindViewById <Android.Widget.Button> (Resource.Id.PlayVideoButton);

            //Give some color to the play button, but not important
            playButton.SetBackgroundColor(Android.Graphics.Color.Aqua);

            if (playFromAssets)
            {
                //relative path to video in Assets folder
                var            filePath = "SampleVideo.mp4";
                ISurfaceHolder holder   = videoView.Holder;
                holder.AddCallback(this);
                player = new  Android.Media.MediaPlayer();
                AssetFileDescriptor afd = Context.Assets.OpenFd(filePath);
                player.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);
            }
            else
            {
                //uri for a free video
                //var uri = Android.Net.Uri.Parse ("https://www.dropbox.com/s/hi45psyy0wq9560/PigsInAPolka1943.mp4?dl=1");
                var uri = Android.Net.Uri.Parse("android.resource://" + Forms.Context.PackageName + "/" + Resource.Raw.SampleVideo);
                //Set the videoView with our uri, this could also be a local video on device
                videoView.SetVideoURI(uri);
            }

            //Assign click event on our play button to play the video
            playButton.Click += PlayVideo;
        }
Ejemplo n.º 37
0
		internal void Prepare()
		{
            Player = new Android.Media.MediaPlayer();
            Player.SetDataSource(Game.contextInstance.Assets.OpenFd(_fileName).FileDescriptor);
            Player.Prepare();
		}
Ejemplo n.º 38
0
		public void Dispose()
		{
            if (media != null)
			{
				media.Dispose();
				media = null;
			}
		}
Ejemplo n.º 39
0
		internal void Prepare()
		{
			
			media = new Android.Media.MediaPlayer();//.Create(Game.Activity,Android.Net.Uri.Parse("file://android_asset/Content/sintel_trailer.mp4"), Game.Instance.Window.Holder);						
			if (media != null )
			{
				var afd = Game.Activity.Assets.OpenFd(_fileName);				
				if (afd != null)
				{					
					media.SetOnCompletionListener(this);			
					media.SetOnVideoSizeChangedListener(this);
					VideoView vv = (VideoView)Game.Activity.FindViewById(MonoGame.Android.Media.VideoViewId);			
					if (vv == null) throw new InvalidOperationException("you must attach a VideoView in a framelayout with its Id set to MonoGame.Android.Media.VideoViewId");
					media.SetDisplay(vv.Holder);							
		            media.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);						
		            media.Prepare();								
				}
			}
		}
Ejemplo n.º 40
0
 void Dispose(bool disposing)
 {
     if (!disposed)
     {
         if (Player != null)
         {
             Player.Dispose();
             Player = null;
         }
         disposed = true;
     }
 }
Ejemplo n.º 41
0
        // Called by the Activity's OnResume
        internal static void Setup()
        {
            lock(lockObject)
            {
                if(player != null)
                    return; // Already setup

                player = new AMP();

                //player.Error = HandleError;
                player.Prepared += HandlePrepared;
                playRequiresReset = false; // player starts in the Idle state

                player.Looping = isRepeating;
                SetPlayerVolume();

                // Check if we are returning from activity-pause and should resume a song...
                if(currentSong != null)
                {
                    InternalPlay(currentSong);
                }
            }
        }
Ejemplo n.º 42
0
 internal void Prepare()
 {
     Player = new Android.Media.MediaPlayer();
     if (Player != null )
     {
         var afd = Game.contextInstance.Assets.OpenFd(_fileName);
         if (afd != null)
         {
             Player.SetDataSource(afd.FileDescriptor, afd.StartOffset, afd.Length);
             Player.Prepare();
         }
     }
 }
Ejemplo n.º 43
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
           WebView web_view = FindViewById<WebView>(Resource.Id.Home_Link);
        

            SetContentView(Resource.Layout.Main);
            ActionBar.Title = "კავკასიის უნივერსიტეტი";
            ActionBar.Hide();
            Window.AddFlags(WindowManagerFlags.Fullscreen);
            ImageButton Home = FindViewById<ImageButton>(Resource.Id.Browser);
            ImageButton Abt = FindViewById<ImageButton>(Resource.Id.Abt);
            ImageButton Gallery = FindViewById<ImageButton>(Resource.Id.Gallery);
            ImageButton Library = FindViewById<ImageButton>(Resource.Id.Library);
            ImageButton Radio = FindViewById<ImageButton>(Resource.Id.Radio);
            ImageButton About = FindViewById<ImageButton>(Resource.Id.About);
            ImageButton Student = FindViewById<ImageButton>(Resource.Id.Student);
            ImageButton chat = FindViewById<ImageButton>(Resource.Id.CUNET);
            //  WebView web_view = FindViewById<WebView>(Resource.Id.Home_Link);
            Home.Click += delegate
            {

                SetContentView(Resource.Layout.Home);
                WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                Home_Lk.Settings.JavaScriptEnabled = true;
                Home_Lk.SetWebViewClient(new WebViewClient());
                Home_Lk.LoadUrl("http://Cu.edu.ge");
            };
            Abt.Click += delegate
            {

                SetContentView(Resource.Layout.Abt);
                TableRow Header = FindViewById<TableRow>(Resource.Id.Header);
                Header.Click += delegate
                 {
                     SetContentView(Resource.Layout.Home);
                     WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                     Home_Lk.Settings.JavaScriptEnabled = true;
                     Home_Lk.SetWebViewClient(new WebViewClient());
                     Home_Lk.LoadUrl("http://cu.edu.ge/ka/applicants");
                 };

            };
            Student.Click += delegate
            {
                SetContentView(Resource.Layout.Home);
                AlertDialog.Builder warrning = new AlertDialog.Builder(this);

                warrning.SetMessage("გთხოვთ გაითვალისწინოთ რომ ამ სერვისით სარგებლობისთვის საჭიროა ინტერნეტ კავშირი");
                WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                Home_Lk.Settings.JavaScriptEnabled = true;
                Home_Lk.SetWebViewClient(new WebViewClient());
                Home_Lk.LoadUrl("file:///android_asset/student.html");


             




    };
            chat.Click += delegate
            {

                SetContentView(Resource.Layout.CHAT);
            };
            Gallery.Click += delegate
            {

                SetContentView(Resource.Layout.Gallery);

            };
            AlertDialog.Builder Alert = new AlertDialog.Builder(this);
          
            Alert.SetMessage("ამ სერვისით სარგებლობისთვის საჭიროა ინტერნეტთან კავშირი");
           
            Library.Click += delegate
            {
                if (!isNetworkAvailable()) Alert.Show();
                else {
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("file:///android_asset/library.html");
                }

            };
            Radio.Click += delegate
            {
            if (!isNetworkAvailable()) Alert.Show();
                else {
                   
                    SetContentView(Resource.Layout.Radio);

                    String url = "http://radiocsm.out.airtime.pro:8000/radiocsm_a?1453386499450.mp3"; // your URL here
                    Android.Media.MediaPlayer mediaPlayer = new Android.Media.MediaPlayer();
                    mediaPlayer.SetDataSource(url);
                    mediaPlayer.PrepareAsync();
                   
                    Button play = FindViewById<Button>(Resource.Id.button1);
                    play.Click +=   delegate
                    {
                        

                        if (!isNetworkAvailable()) Alert.Show();
                        else {
                            if (mediaPlayer.IsPlaying) { mediaPlayer.Pause(); play.Text = "ჩართვა"; }
                            else {
                                mediaPlayer.Start();
                                play.Text = "გამორთვა";
                            }
                        }

                    }; 
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    string ur = "<iframe  height='500px' scrolling='no' frameborder='0' src='http://radiocsm.airtime.pro/embed/weekly-program' width='100%'></iframe>";
                    Home_Lk.LoadData(ur,null,null);
                                  }
                        };

            About.Click += delegate
            {
                string con = "<font color=#336799><strong>მისამართი:</strong></font> პოლიტკოვსკაიას ქ. 10, <br> ქ.თბილისი 0186, საქართველო (ყოფილი ჯიქიას ქუჩა). <br> <font color=#336799><strong> ტელ:</strong></font> (+995 32) 2 37 77 77 <br> <font color=#336799><strong> ფაქსი:</strong></font> (+995 32) 2 31 32 26 <br> <font color=#336799><strong> ელ–ფოსტა:</strong></font> [email protected]";
                SetContentView(Resource.Layout.About);
                ISpanned parsed = Html.FromHtml(con);
                var lines = parsed.ToString();
                TextView contact = FindViewById<TextView>(Resource.Id.Cabout);      
                contact.TextFormatted=(parsed);
                ImageButton facebook = FindViewById<ImageButton>(Resource.Id.facebook);
                ImageButton twitter = FindViewById<ImageButton>(Resource.Id.twitter);
                ImageButton forumge = FindViewById<ImageButton>(Resource.Id.forum);
                ImageButton youtube = FindViewById<ImageButton>(Resource.Id.youtube);
                ImageButton instagram = FindViewById<ImageButton>(Resource.Id.instagram);
                ImageButton myvideo = FindViewById<ImageButton>(Resource.Id.myvideo);
                facebook.Click += delegate{
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("https://www.facebook.com/CaucasusUniversity");
                };
                twitter.Click += delegate {
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("https://twitter.com/CaucasusUni");
                };
                forumge.Click += delegate {
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("https://forum.ge/?f=79&showtopic=34278725&st=0i");
                };
                youtube.Click += delegate {
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("https://www.youtube.com/user/CaucasusUniversity");
                };
                instagram.Click += delegate {
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("https://www.instagram.com/caucasusuniversity/");
                };
                myvideo.Click += delegate {
                    SetContentView(Resource.Layout.Home);
                    WebView Home_Lk = FindViewById<WebView>(Resource.Id.Home_Link);
                    Home_Lk.Settings.JavaScriptEnabled = true;
                    Home_Lk.SetWebViewClient(new WebViewClient());
                    Home_Lk.LoadUrl("http://www.myvideo.ge/caucasusuniversity");
               
                };
            };

        }
Ejemplo n.º 44
0
 static bool HandleError(AMP mp, MediaError what, int extra)
 {
     lock(lockObject)
     {
         DoPlayerReset();
         return true;
     }
 }
Ejemplo n.º 45
0
		public void Dispose()
		{
            if (Player != null)
			{
                Player.Dispose();
                Player = null;
			}
		}
Ejemplo n.º 46
0
        // Called by the Activity's OnPause
        internal static void TearDown()
        {
            lock(lockObject)
            {
                if(player == null)
                    return; // Already torn down

                // If we're currently playing a song, store the seek position for resuming
                queueSeek = hasStarted ? player.CurrentPosition : 0;
                queuePause = !player.IsPlaying;

                // Shut down player and release resources
                player.Release();
                player = null;

                hasStarted = false; // start queuing stop/resume commands
            }
        }
Ejemplo n.º 47
0
 internal void Prepare()
 {
     Player = new Android.Media.MediaPlayer();
     if (Player != null )
     {
         var fd = Game.contextInstance.Assets.OpenFd(_fileName).FileDescriptor;
         if (fd != null)
         {
             Player.SetDataSource(fd);
             Player.Prepare();
         }
     }
 }