本文整理汇总了C#中IMedia.Start方法的典型用法代码示例。如果您正苦于以下问题:C# IMedia.Start方法的具体用法?C# IMedia.Start怎么用?C# IMedia.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMedia
的用法示例。
在下文中一共展示了IMedia.Start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryAddMedia
/// <summary>
/// Adds a stream to the server. If the server is already started then the stream will also be started
/// </summary>
/// <param name="location">The uri of the stream</param>
public bool TryAddMedia(IMedia stream)
{
Exception any = null;
try
{
//Try to add the stream to the dictionary of contained streams.
bool result = Common.Collections.DictionaryExtensions.TryAdd(m_MediaStreams, stream.Id, stream, out any);
if (result && IsRunning) stream.Start();
return result;
}
catch
{
//Possibly already added.
//If we are listening start the stram
if (IsRunning && ContainsMedia(stream.Id))
{
stream.Start();
return true;
}
return false;
}
finally
{
//if (stream != null) stream.TrySetLogger(Logger);
if (Logger != null && any != null) Logger.LogException(any);
}
}