// Add sources to Topology private void SetSources(MediaGraphTopologyProperties graphProperties) { graphProperties.Sources.Add(new MediaGraphRtspSource("rtspSource", new MediaGraphUnsecuredEndpoint("${rtspUrl}") { Credentials = new MediaGraphUsernamePasswordCredentials("${rtspUserName}", "${rtspPassword}") }) ); }
// Add sinks to Topology private void SetSinks(MediaGraphTopologyProperties graphProperties) { var graphNodeInput = new List <MediaGraphNodeInput> { new MediaGraphNodeInput("rtspSource") }; var cachePath = "/var/lib/azuremediaservices/tmp/"; var cacheMaxSize = "2048"; graphProperties.Sinks.Add(new MediaGraphAssetSink("assetSink", graphNodeInput, "sampleAsset-${System.GraphTopologyName}-${System.GraphInstanceName}", cachePath, cacheMaxSize) { SegmentLength = System.Xml.XmlConvert.ToString(TimeSpan.FromSeconds(30)), }); }
private MediaGraphTopology BuildGraphTopology() { var graphProperties = new MediaGraphTopologyProperties { Description = "Continuous video recording to an Azure Media Services Asset", }; SetParameters(graphProperties); SetSources(graphProperties); SetSinks(graphProperties); return(new MediaGraphTopology("ContinuousRecording") { Properties = graphProperties }); }
// Add parameters to Topology private void SetParameters(MediaGraphTopologyProperties graphProperties) { graphProperties.Parameters.Add(new MediaGraphParameterDeclaration("rtspUserName", MediaGraphParameterType.String) { Description = "rtsp source user name.", Default = "dummyUserName" }); graphProperties.Parameters.Add(new MediaGraphParameterDeclaration("rtspPassword", MediaGraphParameterType.SecretString) { Description = "rtsp source password.", Default = "dummyPassword" }); graphProperties.Parameters.Add(new MediaGraphParameterDeclaration("rtspUrl", MediaGraphParameterType.String) { Description = "rtsp Url" }); }