setOnPreparedListener() public method

public setOnPreparedListener ( android arg0 ) : void
arg0 android
return void
        protected override void onCreate(Bundle savedInstanceState)
        {
            this.ApplicationFile = "Class5.htm";
            this.ApplicationScale = 200;


            this.onpagefinished =
                delegate
                {
                    try
                    {
                        // http://www.aganazzar.com/midi.html
                        // http://www.lastown.com/public/musique/warcraft/list.html
                        // http://gamemusic.wordpress.com/2007/12/09/warcraft-1-orcs-and-humans/



                        if (mediaPlayer != null)
                            mediaPlayer.stop();

                        mediaPlayer = new MediaPlayer();

                        var n = "zak.mp3";

                        if (width < height)
                            n = "Zak McKracken (Main Titles).mid";

                        var assetFileDescritor = this.getAssets().openFd(n);

                        mediaPlayer.reset();

                        mediaPlayer.setDataSource(

                            //"IntroWarII.mp3");

                            assetFileDescritor.getFileDescriptor(),
                            assetFileDescritor.getStartOffset(),
                            assetFileDescritor.getLength()
                            );

                        //add this ? ---------------------------------------
                        //close the descriptor
                        assetFileDescritor.close();
                        //add this ? ---------------------------------------


                        //mediaPlayer.prepare();
                        mediaPlayer.setOnPreparedListener(
                            new _prepared { }
                        );
                        //mediaPlayer.setOnCompletionListener(
                        //    new _OnCompletionListener());

                        //mediaPlayer.setOnErrorListener(
                        //    new _OnErrorListener());


                        mediaPlayer.prepare();
                        mediaPlayer.setLooping(true);

                        //this.ShowLongToast("music: " + n);
                    }
                    catch //(System.Exception e)
                    {
                        //this.ShowLongToast("error " + ((object)e).ToString());

                        //throw;
                    }
                };

            base.onCreate(savedInstanceState);

            
        }
        protected override void onCreate(Bundle savedInstanceState)
        {
            this.ApplicationFile = "index.htm";
            this.ApplicationScale = 150;


            this.onpagefinished =
                delegate
                {
                    try
                    {
                        // http://www.aganazzar.com/midi.html
                        // http://www.lastown.com/public/musique/warcraft/list.html
                        // http://gamemusic.wordpress.com/2007/12/09/warcraft-1-orcs-and-humans/



                        if (mediaPlayer != null)
                            mediaPlayer.stop();

                        mediaPlayer = new MediaPlayer();

                        var music = "Warcraft1_TitleTheme.mid";

                        if (width > height)
                            music = "war-gfx/intro.mid";

                        var  assetFileDescritor = this.getAssets().openFd(music);

                        mediaPlayer.reset();

                        mediaPlayer.setDataSource(

                            //"IntroWarII.mp3");

                            assetFileDescritor.getFileDescriptor(),
                            assetFileDescritor.getStartOffset(),
                            assetFileDescritor.getLength()
                            );

                        //add this ? ---------------------------------------
                        //close the descriptor
                        assetFileDescritor.close();
                        //add this ? ---------------------------------------


                        //mediaPlayer.prepare();
                        mediaPlayer.setOnPreparedListener(
                            new _prepared { }
                        );
                 

                        mediaPlayer.prepare();
                        mediaPlayer.setLooping(true);

                        this.ShowLongToast(new { music }.ToString());
                    }
                    catch (System.Exception e)
                    {
                        this.ShowLongToast("error " + ((object)e).ToString());

                        //throw;
                    }
                };

            base.onCreate(savedInstanceState);

        }