public static string CreatePushUrl(string domain, string app, string stream, DateTime expireTime) { long unixExpire = CustomUtil.Unix10TimeStamp(expireTime); string secret = "56a2e2438f375ed3e8bf8ea02e7f8d51"; var timeHex = unixExpire.ToString("x8").ToUpper(); var token = CustomUtil.Md5Encrypt($@"{secret}{app}_{stream}{timeHex}", new UTF8Encoding()); return($@"rtmp://{app}.{domain}/live/{app}_{stream}?bizid={app}&txSecret={token}&txTime={timeHex}"); }
public static string CreatePlayUrl(string domain, string app, string stream, DateTime expireTime, PlayType type) { string secret = "qn4ff9kxqxh9u8o9rusne7y1qz04ufrs"; var timeStamp = CustomUtil.Unix10TimeStamp(expireTime); var md5 = CustomUtil.Md5Encrypt($@"{secret}/{domain}/{app}/{stream}{expireTime}", new UTF8Encoding()); switch (type) { case PlayType.flv: { return($@"http://{domain}/{app}/{stream}.flv?timestamp={timeStamp}&secret={md5}"); } default: { return($@"http://{domain}/{app}/{stream}?timestamp={timeStamp}&secret={md5}"); } } }