decord/source/modules/go_live/utils/StreamKeyUtils.tsx

60 lines
1.9 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 4195
2026-07-27 11:26:19 +00:00
// Function ID: 36087
2026-07-20 16:05:17 +00:00
// Name: isStreamKey
2026-07-25 08:10:48 +00:00
// Dependencies: [57, 4196, 2]
2026-07-20 16:05:17 +00:00
// Exports: decodeStreamKey, encodeStreamKey, isStreamKey
2026-07-25 08:10:48 +00:00
// Module 4195 (isStreamKey)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import { StreamTypes } from "StreamIssueReportReasons";
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("modules/go_live/utils/StreamKeyUtils.tsx");
export const isStreamKey = function isStreamKey(c29) {
let tmp = null != c29;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-23 10:11:24 +00:00
let startsWithResult = c29.startsWith(StreamTypes.GUILD);
2026-07-20 16:05:17 +00:00
if (!startsWithResult) {
2026-07-23 10:11:24 +00:00
startsWithResult = c29.startsWith(StreamTypes.CALL);
2026-07-20 16:05:17 +00:00
}
tmp = startsWithResult;
}
return tmp;
};
export const decodeStreamKey = function decodeStreamKey(streamKey) {
const parts = streamKey.split(":");
const first = parts[0];
if (StreamTypes.GUILD === first) {
const tmp12 = callback(parts, 4);
let obj = { streamType: tmp12[0], guildId: tmp12[1], channelId: tmp12[2], ownerId: tmp12[3] };
return obj;
} else if (StreamTypes.CALL === first) {
const tmp10 = callback(parts, 3);
obj = { streamType: tmp10[0], channelId: tmp10[1], ownerId: tmp10[2] };
return obj;
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const error = new Error("Unknown stream type " + first);
throw error;
}
};
export const encodeStreamKey = function encodeStreamKey(currentUserActiveStream) {
let channelId;
let ownerId;
let streamType;
({ streamType, channelId, ownerId } = currentUserActiveStream);
if (StreamTypes.GUILD === streamType) {
const items = [streamType, tmp, channelId, ownerId];
return items.join(":");
} else if (StreamTypes.CALL === streamType) {
const items1 = [streamType, channelId, ownerId];
return items1.join(":");
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
const error = new Error("Unknown stream type " + streamType);
throw error;
}
};