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