fix 直播播放地址
This commit is contained in:
parent
a0304e97df
commit
f7c1bdb782
|
|
@ -110,7 +110,6 @@ function getLivestream(params, context) {
|
|||
case 2:
|
||||
token = (_a.sent()).token;
|
||||
url = "http://pili.qiniuapi.com/v2/hubs/".concat(hub, "/streams");
|
||||
console.log(bodyStr, url, token);
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
@ -165,16 +164,16 @@ function getLivestream2(params, context) {
|
|||
exports.getLivestream2 = getLivestream2;
|
||||
function getStreamObj(config, streamTitle, expireAt) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var hub, publishDomain, rtmpPlayDomain, publishKey, playKey, signStr, sourcePath, token, rtmpPushUrl, t, playSign, rtmpPlayUrl, pcPushUrl, streamKey;
|
||||
var hub, publishDomain, playDomain, publishKey, playKey, signStr, sourcePath, token, rtmpPushUrl, t, playSign, rtmpPlayUrl, pcPushUrl, streamKey;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
hub = config.hub, publishDomain = config.publishDomain, rtmpPlayDomain = config.rtmpPlayDomain, publishKey = config.publishKey, playKey = config.playKey;
|
||||
hub = config.hub, publishDomain = config.publishDomain, playDomain = config.playDomain, publishKey = config.publishKey, playKey = config.playKey;
|
||||
signStr = "/".concat(hub, "/").concat(streamTitle, "?expire=").concat(expireAt);
|
||||
sourcePath = "/".concat(hub, "/").concat(streamTitle);
|
||||
token = (0, sign_1.base64ToUrlSafe)((0, sign_1.hmacSha1)(signStr, publishKey));
|
||||
rtmpPushUrl = "rtmp://".concat(publishDomain).concat(signStr, "&token=").concat(token);
|
||||
t = expireAt.toString(16).toLowerCase();
|
||||
playSign = ts_md5_1.Md5.hashStr(playKey + sourcePath + t).toString().toLowerCase();
|
||||
rtmpPlayUrl = "rtmp://".concat(rtmpPlayDomain).concat(sourcePath, "?sign=").concat(playSign, "&t=").concat(t);
|
||||
rtmpPlayUrl = "https://".concat(playDomain).concat(sourcePath, ".m3u8?sign=").concat(playSign, "&t=").concat(t);
|
||||
pcPushUrl = "rtmp://".concat(publishDomain, "/").concat(hub, "/");
|
||||
streamKey = "".concat(streamTitle, "?expire=").concat(expireAt, "&token=").concat(token);
|
||||
return [2 /*return*/, {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ exports.default = OakPage({
|
|||
var _a, _b;
|
||||
var _c = ele || {}, mobile$user = _c.mobile$user, extraFile$entity = _c.extraFile$entity;
|
||||
var mobile = mobile$user && ((_a = mobile$user[0]) === null || _a === void 0 ? void 0 : _a.mobile);
|
||||
var relations = (_b = ele["user".concat(entityStr, "$user")]) === null || _b === void 0 ? void 0 : _b.filter(function (ele) { return ele["".concat(entity, "Id")] === entityId; }).map(function (ele) { return ele.relation; });
|
||||
var relations = (_b = ele["user".concat(entityStr, "$user")]) === null || _b === void 0 ? void 0 : _b.filter(function (rt) { return rt["".concat(entity, "Id")] === entityId; }).map(function (rt2) { return rt2.relation; });
|
||||
var avatar = extraFile$entity &&
|
||||
extraFile$entity[0] &&
|
||||
(0, extraFile_1.composeFileUrl)(extraFile$entity[0]);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,6 @@ export async function getLivestream<ED extends EntityDict, Cxt extends RuntimeCo
|
|||
});
|
||||
|
||||
const url = `http://pili.qiniuapi.com/v2/hubs/${hub}/streams`;
|
||||
console.log(bodyStr, url, token);
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
@ -168,7 +167,7 @@ export async function getLivestream2<ED extends EntityDict, Cxt extends RuntimeC
|
|||
async function getStreamObj(
|
||||
config: {
|
||||
publishDomain: string,
|
||||
rtmpPlayDomain: string,
|
||||
playDomain: string,
|
||||
hub: string,
|
||||
publishKey: string,
|
||||
playKey: string,
|
||||
|
|
@ -187,7 +186,7 @@ async function getStreamObj(
|
|||
>
|
||||
{
|
||||
// 生成推流地址
|
||||
const {hub, publishDomain, rtmpPlayDomain, publishKey, playKey } = config;
|
||||
const { hub, publishDomain, playDomain, publishKey, playKey } = config;
|
||||
const signStr = `/${hub}/${streamTitle}?expire=${expireAt}`;
|
||||
const sourcePath = `/${hub}/${streamTitle}`;
|
||||
const token = base64ToUrlSafe(hmacSha1(signStr, publishKey));
|
||||
|
|
@ -195,7 +194,7 @@ async function getStreamObj(
|
|||
// 生成播放地址
|
||||
const t = expireAt.toString(16).toLowerCase();
|
||||
const playSign = Md5.hashStr(playKey + sourcePath + t).toString().toLowerCase();
|
||||
const rtmpPlayUrl = `rtmp://${rtmpPlayDomain}${sourcePath}?sign=${playSign}&t=${t}`;
|
||||
const rtmpPlayUrl = `https://${playDomain}${sourcePath}.m3u8?sign=${playSign}&t=${t}`;
|
||||
// obs推流需要的地址和串流密钥
|
||||
const pcPushUrl = `rtmp://${publishDomain}/${hub}/`;
|
||||
const streamKey = `${streamTitle}?expire=${expireAt}&token=${token}`
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export default OakPage({
|
|||
},
|
||||
],
|
||||
isList: true,
|
||||
formData: async function ({ data: users, props, features }) {
|
||||
async formData ({ data: users, props, features }) {
|
||||
const { entity, entityId } = props;
|
||||
const entityStr = firstLetterUpperCase(entity!);
|
||||
const filter = await this.getFilterByName('name');
|
||||
|
|
@ -82,8 +82,8 @@ export default OakPage({
|
|||
const { mobile$user, extraFile$entity } = ele || {};
|
||||
const mobile = mobile$user && mobile$user[0]?.mobile;
|
||||
const relations = ele[`user${entityStr}$user`]
|
||||
?.filter((ele: any) => ele[`${entity}Id`] === entityId)
|
||||
.map((ele: any) => ele.relation);
|
||||
?.filter((rt: any) => rt[`${entity}Id`] === entityId)
|
||||
.map((rt2: any) => rt2.relation);
|
||||
const avatar =
|
||||
extraFile$entity &&
|
||||
extraFile$entity[0] &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue