public static bool SupportsConfig(MixCastData.StreamingService service, string targetFormat, string fps, string res) { try { var platform = streamInfo[service]; if (platform == null) { return(false); } var format = platform[targetFormat]; if (format == null) { return(false); } if (format.ContainsKey(fps) && format[fps].Contains(res)) { return(true); } } catch { } return(false); }
public static bool SupportsSampleRate(MixCastData.StreamingService service, string targetFormat, string sampleRate) { try { var platform = streamInfo[service]; if (platform == null) { return(false); } var format = platform[targetFormat]; if (format == null) { return(false); } if (format["sampleRates"].Contains(sampleRate)) { return(true); } } catch { } return(false); }
/// <summary> /// Adds service-specific parameters to the URL string. /// </summary> static string AppendServiceParams(MixCastData.StreamingService service, string url, bool debug) { switch (service) { case MixCastData.StreamingService.Twitch: var debugParam = debug ? "?bandwidthtest=true" : ""; return(url + debugParam); default: return(url); } }
public static bool GetConfigSupportStringID(MixCastData.StreamingService service, string targetFormat, string fps, string res, ref string outString) { try { var platform = streamInfo[service]; if (platform == null) { return(false); } var format = platform[targetFormat]; if (format == null) { return(false); } if (format.ContainsKey(fps)) { if (System.Convert.ToInt32(fps) == 30) { outString = ""; return(true); } if (format[fps].Contains(res)) { outString = "Field_StreamConfigWarn"; return(true); } else { outString = "Field_ResolutionStreamWarn"; return(false); } } else { outString = "Field_FPSStreamWarn"; return(false); } } catch { } return(false); }
/// <summary> /// Creates the URL to stream to. /// </summary> public static string ConstructStreamUrl(MixCastData.StreamingService service, string streamUrl, string streamKey, bool debug = false) { switch (service) { case MixCastData.StreamingService.None: return(null); case MixCastData.StreamingService.Custom: if (string.IsNullOrEmpty(streamUrl)) { return(null); } if (!string.IsNullOrEmpty(streamKey)) { streamUrl = streamUrl.Trim('/') + "/" + streamKey; } if (!streamUrl.StartsWith(rtmpScheme)) { streamUrl = rtmpScheme + streamUrl; } break; default: StreamingServer[] servers; if (!StreamingServerList.serviceUrls.TryGetValue(service, out servers)) { var message = string.Format("Haven't implemented {0} streaming yet", service); throw new NotImplementedException(message); } if (string.IsNullOrEmpty(streamKey)) { return(null); } streamUrl = servers[0].url + streamKey; break; } return(AppendServiceParams(service, streamUrl, debug)); }