public static void Main() { try { // Create WMEncoderApp and WMEncoder objects. WMEncoderApp EncoderApp = new WMEncoderApp(); WMEncoder wmEncoder = new WMEncoder(); IWMEncoder Encoder = EncoderApp.Encoder; wmEncoder.OnAcquireCredentials += new _IWMEncoderEvents_OnAcquireCredentialsEventHandler(wmEncoder_OnAcquireCredentials); // Display the predefined Encoder UI. EncoderApp.Visible = true; // Specify the source for the input stream. IWMEncSourceGroupCollection SrcGrpColl = wmEncoder.SourceGroupCollection; IWMEncSourceGroup SrcGrp = SrcGrpColl.Add("Test"); IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO); IWMEncVideoSource2 SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO); SrcAud.SetInput("Default_Audio_Device", "Device", ""); SrcVid.SetInput("Default_Video_Device", "Device", ""); // Specify a profile. IWMEncProfile Pro; IWMEncProfileCollection ProColl = wmEncoder.ProfileCollection; for (int i = 0; i < ProColl.Count; i++) { Pro = ProColl.Item(i); if (Pro.Name == "Windows Media Video 8 for Local Area Network (384 Kbps)") { SrcGrp.set_Profile(Pro); break; } } string strServerName = "ServerName:PortNumber"; string strPubPoint = "23"; string strPubTemplate = "Live"; //Broadcast a Live Event IWMEncPushDistribution PushDist = (IWMEncPushDistribution)wmEncoder.Broadcast; IWMEncBroadcast BrdCst = wmEncoder.Broadcast; BrdCst.set_PortNumber(WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_HTTP, 82); //BrdCst.set_PortNumber(WMENC_BROADCAST_PROTOCOL.WMENC_PROTOCOL_PUSH_DISTRIBUTION, 82); // Set the push distribution variables. //string MyNSCFile = "\\SNGS-DEMO\\Test\\MyPubPoint.nsc"; //string MyNSCURL = "\\SNGS-DEMO\\Test\\MyPubPoint.nsc"; // string MyASXFile = "\\SNGS-DEMO\\Test\\MyPubPoint.asx"; PushDist.AutoRemovePublishingPoint = true; // Generate the announcement file. PushDist.ServerName = strServerName; PushDist.PublishingPoint = strPubPoint; PushDist.Template = strPubTemplate; // PushDist.GenerateMulticastInfoFile(MyNSCFile); // PushDist.GenerateAnnouncementFile(MyNSCURL, MyASXFile); // Retrieve the IWMSPublishingPoints object. //PubPoints = winMServer.PublishingPoints; // Create a new WMSServer object. winMServer = new WMSServer(); winMServer.AllowClientsToConnect = true; // Retrieve the IWMSPlugin object for the // WMS Publishing Points ACL Authorization plug-in. //Plugin = winMServer.EventHandlers["WMS Publishing Points ACL Authorization"]; // Retrieve the administrative interface for the // WMS Publishing Points ACL Authorization plug-in. //IWMSACLCheckAdmin ACLCheckAdmin = (IWMSACLCheckAdmin)Plugin.CustomInterface; // Retrieve the list of access control entries. //IWMSAccessControlList AccessCtrlList = ACLCheckAdmin.AccessControlList; //// Specify the push distribution variables, including the Windows Media //// server name, publishing point, and announcement files. wmEncoder.OnStateChange += new _IWMEncoderEvents_OnStateChangeEventHandler(wmEncoder_OnStateChange); wmEncoder.OnSourceStateChange += new _IWMEncoderEvents_OnSourceStateChangeEventHandler(wmEncoder_OnSourceStateChange); //Server Credentials wmEncoder.PrepareToEncode(true); wmEncoder.Start(); } catch (Exception e) { // TODO: Handle exceptions. } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)