Ejemplo n.º 1
0
        public void InitializeEncoder()
        {
            try
            {
                frm_Rec=new WebMeeting.Client.Screen_Capture.frm_Rec();
                config=new Config();
                config.cfgFile = "WebMeeting.exe.config";

                // create encoder object
                m_encoder = new WMEncoder();
                m_encoder.DisplayInfo.Author="Zaeem";
                m_encoder.DisplayInfo.Copyright="Uraan Software Solutions";
                m_encoder.DisplayInfo.Description="Uraan Generated Media File for Screen Recording";
                m_encoder.DisplayInfo.Title="Recorded Screen";
                m_encoder.DisplayInfo.Title="Recorded Screen";
                m_encoder.DisplayInfo.Rating="1";
                m_encoder.DisplayInfo.Description="This file is Generated through CampusNav developed by Uraan Software Solution";

                // retrive source group collection
                m_sourceGroupCollection = m_encoder.SourceGroupCollection;

                // add a source group to collection
                m_srcGrp = m_sourceGroupCollection.Add("SG_1");

                m_sourceEnumDlg= new SourceEnum();

                // add a screen source
                if(EnumerateAudioSources())
                {
                    m_audSource = m_srcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
                    m_audSource.SetInput(m_szAudioSource, "Device", "");
                }

                // set screen as source
                m_screenSource = (IWMEncVideoSource2)m_srcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
                m_screenSource.SetInput("ScreenCapture1", "ScreenCap", "");

            }
            catch(Exception  exp)
            {

                WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Video Recordong Module ===>Screen Capture.cs line==> 99",exp,"Error Loading Encoder: " + exp.Message.ToString(),false);
                if( MessageBox.Show("Either You do not have required components of Windows Media Encoder or they are corrupted on your Machine: "+ /*+exp.Message.ToString() + */". Do you want to download now?","WebMeeting",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    Win32.Shell32.ShellExecute(0,"Open",WebMeeting.Client.Info.getInstance().WebsiteName + "/wmencoder.exe","","",1);
                }

                //WebMeeting.Client.ClientUI.getInstance().ShowExceptionMessage("Error Stoping encoder: " + exp.Message.ToString());
                //Trace.WriteLine(exp.ToString()+"---"+exp.Message+"---"+exp.Source+exp.StackTrace+"---"+exp.TargetSite+"---"+exp.InnerException);

            }
        }