@byteplus/veplayer-plugin 2.4.2-rc.0 → 2.4.2-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.development.js +740 -128
- package/esm/index.production.js +4 -4
- package/esm/veplayer.plugin.rtm.development.js +696 -84
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.rtm.development.js +696 -84
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.__VEPLAYER_PLUGIN_RTM__ = {}));
|
|
3
3
|
})(this, function(exports2) {
|
|
4
4
|
"use strict";
|
|
5
|
+
function _iterableToArrayLimit(arr, i) {
|
|
6
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
7
|
+
if (null != _i) {
|
|
8
|
+
var _s, _e, _x, _r, _arr = [], _n = true, _d = false;
|
|
9
|
+
try {
|
|
10
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
11
|
+
if (Object(_i) !== _i)
|
|
12
|
+
return;
|
|
13
|
+
_n = false;
|
|
14
|
+
} else
|
|
15
|
+
for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = true)
|
|
16
|
+
;
|
|
17
|
+
} catch (err) {
|
|
18
|
+
_d = true, _e = err;
|
|
19
|
+
} finally {
|
|
20
|
+
try {
|
|
21
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r))
|
|
22
|
+
return;
|
|
23
|
+
} finally {
|
|
24
|
+
if (_d)
|
|
25
|
+
throw _e;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return _arr;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
5
31
|
function ownKeys$2(object, enumerableOnly) {
|
|
6
32
|
var keys = Object.keys(object);
|
|
7
33
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -479,6 +505,104 @@
|
|
|
479
505
|
return _possibleConstructorReturn$1(this, result);
|
|
480
506
|
};
|
|
481
507
|
}
|
|
508
|
+
function _slicedToArray(arr, i) {
|
|
509
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$2(arr, i) || _nonIterableRest();
|
|
510
|
+
}
|
|
511
|
+
function _toConsumableArray$1(arr) {
|
|
512
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$2(arr) || _nonIterableSpread$1();
|
|
513
|
+
}
|
|
514
|
+
function _arrayWithoutHoles$1(arr) {
|
|
515
|
+
if (Array.isArray(arr))
|
|
516
|
+
return _arrayLikeToArray$2(arr);
|
|
517
|
+
}
|
|
518
|
+
function _arrayWithHoles(arr) {
|
|
519
|
+
if (Array.isArray(arr))
|
|
520
|
+
return arr;
|
|
521
|
+
}
|
|
522
|
+
function _iterableToArray$1(iter) {
|
|
523
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
524
|
+
return Array.from(iter);
|
|
525
|
+
}
|
|
526
|
+
function _unsupportedIterableToArray$2(o, minLen) {
|
|
527
|
+
if (!o)
|
|
528
|
+
return;
|
|
529
|
+
if (typeof o === "string")
|
|
530
|
+
return _arrayLikeToArray$2(o, minLen);
|
|
531
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
532
|
+
if (n === "Object" && o.constructor)
|
|
533
|
+
n = o.constructor.name;
|
|
534
|
+
if (n === "Map" || n === "Set")
|
|
535
|
+
return Array.from(o);
|
|
536
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
537
|
+
return _arrayLikeToArray$2(o, minLen);
|
|
538
|
+
}
|
|
539
|
+
function _arrayLikeToArray$2(arr, len) {
|
|
540
|
+
if (len == null || len > arr.length)
|
|
541
|
+
len = arr.length;
|
|
542
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
543
|
+
arr2[i] = arr[i];
|
|
544
|
+
return arr2;
|
|
545
|
+
}
|
|
546
|
+
function _nonIterableSpread$1() {
|
|
547
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
548
|
+
}
|
|
549
|
+
function _nonIterableRest() {
|
|
550
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
551
|
+
}
|
|
552
|
+
function _createForOfIteratorHelper$1(o, allowArrayLike) {
|
|
553
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
554
|
+
if (!it) {
|
|
555
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
556
|
+
if (it)
|
|
557
|
+
o = it;
|
|
558
|
+
var i = 0;
|
|
559
|
+
var F = function() {
|
|
560
|
+
};
|
|
561
|
+
return {
|
|
562
|
+
s: F,
|
|
563
|
+
n: function() {
|
|
564
|
+
if (i >= o.length)
|
|
565
|
+
return {
|
|
566
|
+
done: true
|
|
567
|
+
};
|
|
568
|
+
return {
|
|
569
|
+
done: false,
|
|
570
|
+
value: o[i++]
|
|
571
|
+
};
|
|
572
|
+
},
|
|
573
|
+
e: function(e) {
|
|
574
|
+
throw e;
|
|
575
|
+
},
|
|
576
|
+
f: F
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
580
|
+
}
|
|
581
|
+
var normalCompletion = true, didErr = false, err;
|
|
582
|
+
return {
|
|
583
|
+
s: function() {
|
|
584
|
+
it = it.call(o);
|
|
585
|
+
},
|
|
586
|
+
n: function() {
|
|
587
|
+
var step = it.next();
|
|
588
|
+
normalCompletion = step.done;
|
|
589
|
+
return step;
|
|
590
|
+
},
|
|
591
|
+
e: function(e) {
|
|
592
|
+
didErr = true;
|
|
593
|
+
err = e;
|
|
594
|
+
},
|
|
595
|
+
f: function() {
|
|
596
|
+
try {
|
|
597
|
+
if (!normalCompletion && it.return != null)
|
|
598
|
+
it.return();
|
|
599
|
+
} finally {
|
|
600
|
+
if (didErr)
|
|
601
|
+
throw err;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
}
|
|
482
606
|
function _toPrimitive$2(input, hint) {
|
|
483
607
|
if (typeof input !== "object" || input === null)
|
|
484
608
|
return input;
|
|
@@ -5065,6 +5189,519 @@
|
|
|
5065
5189
|
}]);
|
|
5066
5190
|
return NetworkEvaluate2;
|
|
5067
5191
|
}();
|
|
5192
|
+
var RTC_SEI_TYPE = /* @__PURE__ */ function(RTC_SEI_TYPE2) {
|
|
5193
|
+
RTC_SEI_TYPE2[RTC_SEI_TYPE2["internal"] = 0] = "internal";
|
|
5194
|
+
RTC_SEI_TYPE2[RTC_SEI_TYPE2["external"] = 1] = "external";
|
|
5195
|
+
RTC_SEI_TYPE2[RTC_SEI_TYPE2["bypass"] = 2] = "bypass";
|
|
5196
|
+
return RTC_SEI_TYPE2;
|
|
5197
|
+
}(RTC_SEI_TYPE || {});
|
|
5198
|
+
var UUID_INTERNAL = new Uint8Array([109, 167, 53, 190, 103, 90, 72, 1, 170, 89, 63, 164, 194, 199, 19, 85]);
|
|
5199
|
+
var UUID_EXTERNAL = new Uint8Array([109, 167, 53, 190, 103, 90, 72, 1, 170, 89, 63, 164, 194, 199, 19, 84]);
|
|
5200
|
+
var rbsp2ebsp = function rbsp2ebsp2(src) {
|
|
5201
|
+
var result = [];
|
|
5202
|
+
for (var i = 0; i < src.length; i++) {
|
|
5203
|
+
if (src[i] <= 3 && src[i - 1] === 0 && src[i - 2] === 0) {
|
|
5204
|
+
result.push(3);
|
|
5205
|
+
}
|
|
5206
|
+
result.push(src[i]);
|
|
5207
|
+
}
|
|
5208
|
+
return new Uint8Array(result);
|
|
5209
|
+
};
|
|
5210
|
+
var ebsp2rbsp = function ebsp2rbsp2(src) {
|
|
5211
|
+
var result = [];
|
|
5212
|
+
for (var i = 0; i < src.length; i++) {
|
|
5213
|
+
if (src[i] <= 3 && src[i - 1] === 0 && src[i - 2] === 0) {
|
|
5214
|
+
continue;
|
|
5215
|
+
}
|
|
5216
|
+
result.push(src[i]);
|
|
5217
|
+
}
|
|
5218
|
+
return new Uint8Array(result);
|
|
5219
|
+
};
|
|
5220
|
+
function serializeData(num) {
|
|
5221
|
+
var result = [];
|
|
5222
|
+
while (num >= 255) {
|
|
5223
|
+
num -= 255;
|
|
5224
|
+
result.push(255);
|
|
5225
|
+
}
|
|
5226
|
+
result.push(num);
|
|
5227
|
+
return new Uint8Array(result);
|
|
5228
|
+
}
|
|
5229
|
+
function deserializeData(data) {
|
|
5230
|
+
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
5231
|
+
var result = 0;
|
|
5232
|
+
while (data[offset] === 255 && offset < data.byteLength) {
|
|
5233
|
+
offset++;
|
|
5234
|
+
result += 255;
|
|
5235
|
+
}
|
|
5236
|
+
if (offset < data.byteLength) {
|
|
5237
|
+
result += data[offset++];
|
|
5238
|
+
}
|
|
5239
|
+
return [result, offset];
|
|
5240
|
+
}
|
|
5241
|
+
var SEIHelper = /* @__PURE__ */ function() {
|
|
5242
|
+
function SEIHelper2() {
|
|
5243
|
+
_classCallCheck$2(this, SEIHelper2);
|
|
5244
|
+
}
|
|
5245
|
+
_createClass$2(SEIHelper2, null, [{
|
|
5246
|
+
key: "generateSEI",
|
|
5247
|
+
value: function generateSEI(src) {
|
|
5248
|
+
var internal = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
5249
|
+
var annexbHeader = new Uint8Array([0, 0, 0, 1]);
|
|
5250
|
+
var nalType = new Uint8Array([6]);
|
|
5251
|
+
var seiType = new Uint8Array([5]);
|
|
5252
|
+
var uuid = internal ? UUID_INTERNAL : UUID_EXTERNAL;
|
|
5253
|
+
var serializedPayloadSize = serializeData(src.byteLength + uuid.byteLength);
|
|
5254
|
+
var payloadEbsp = rbsp2ebsp(src);
|
|
5255
|
+
return new Uint8Array([].concat(_toConsumableArray$1(annexbHeader), _toConsumableArray$1(nalType), _toConsumableArray$1(seiType), _toConsumableArray$1(serializedPayloadSize), _toConsumableArray$1(uuid), _toConsumableArray$1(payloadEbsp), [128]));
|
|
5256
|
+
}
|
|
5257
|
+
}, {
|
|
5258
|
+
key: "decodeSeiBody",
|
|
5259
|
+
value: function decodeSeiBody(src) {
|
|
5260
|
+
src = src.slice(0, src.length - 1);
|
|
5261
|
+
var rbsp = ebsp2rbsp(src);
|
|
5262
|
+
if (rbsp.byteLength < 2) {
|
|
5263
|
+
return;
|
|
5264
|
+
}
|
|
5265
|
+
var offset = 0;
|
|
5266
|
+
if (!(rbsp[1] === 5 || rbsp[1] === 100)) {
|
|
5267
|
+
return;
|
|
5268
|
+
}
|
|
5269
|
+
offset += 2;
|
|
5270
|
+
var _deserializeData = deserializeData(rbsp, offset), _deserializeData2 = _slicedToArray(_deserializeData, 2), payloadLength = _deserializeData2[0], newOffset = _deserializeData2[1];
|
|
5271
|
+
offset = newOffset;
|
|
5272
|
+
var rtcSeiType = 2;
|
|
5273
|
+
var end = offset + payloadLength;
|
|
5274
|
+
if (rbsp.byteLength >= UUID_EXTERNAL.byteLength && payloadLength >= UUID_EXTERNAL.byteLength && rbsp.slice(offset, offset + UUID_EXTERNAL.byteLength).toString() === UUID_EXTERNAL.toString()) {
|
|
5275
|
+
offset += UUID_EXTERNAL.byteLength;
|
|
5276
|
+
rtcSeiType = 1;
|
|
5277
|
+
} else if (rbsp.byteLength >= UUID_EXTERNAL.byteLength && payloadLength >= UUID_EXTERNAL.byteLength && rbsp.slice(offset, offset + UUID_INTERNAL.byteLength).toString() === UUID_INTERNAL.toString()) {
|
|
5278
|
+
offset += UUID_INTERNAL.byteLength;
|
|
5279
|
+
rtcSeiType = 0;
|
|
5280
|
+
}
|
|
5281
|
+
var seiPayload = rbsp.slice(offset, end);
|
|
5282
|
+
return {
|
|
5283
|
+
type: rtcSeiType,
|
|
5284
|
+
payload: seiPayload
|
|
5285
|
+
};
|
|
5286
|
+
}
|
|
5287
|
+
}, {
|
|
5288
|
+
key: "parseInternalSEI",
|
|
5289
|
+
value: function parseInternalSEI(decodedSEI) {
|
|
5290
|
+
var result = /* @__PURE__ */ new Map();
|
|
5291
|
+
var offset = 0;
|
|
5292
|
+
if (decodedSEI.type === 0) {
|
|
5293
|
+
while (decodedSEI.payload.byteLength - offset >= 2) {
|
|
5294
|
+
var _deserializeData3 = deserializeData(decodedSEI.payload, offset), _deserializeData4 = _slicedToArray(_deserializeData3, 2), internalSeiType = _deserializeData4[0], newOffset = _deserializeData4[1];
|
|
5295
|
+
offset = newOffset;
|
|
5296
|
+
var _deserializeData5 = deserializeData(decodedSEI.payload, offset), _deserializeData6 = _slicedToArray(_deserializeData5, 2), internalSeiLength = _deserializeData6[0], newOff = _deserializeData6[1];
|
|
5297
|
+
offset = newOff;
|
|
5298
|
+
if (!result.get(internalSeiType) && internalSeiLength <= decodedSEI.payload.byteLength - offset) {
|
|
5299
|
+
result.set(internalSeiType, decodedSEI.payload.slice(offset, offset + internalSeiLength));
|
|
5300
|
+
offset += internalSeiLength;
|
|
5301
|
+
} else {
|
|
5302
|
+
break;
|
|
5303
|
+
}
|
|
5304
|
+
}
|
|
5305
|
+
return result;
|
|
5306
|
+
}
|
|
5307
|
+
}
|
|
5308
|
+
}, {
|
|
5309
|
+
key: "makeInternalSei",
|
|
5310
|
+
value: function makeInternalSei(map) {
|
|
5311
|
+
var resultSeiList = [];
|
|
5312
|
+
var _iterator = _createForOfIteratorHelper$1(map), _step;
|
|
5313
|
+
try {
|
|
5314
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
5315
|
+
var _step$value = _slicedToArray(_step.value, 2), type = _step$value[0], payload = _step$value[1];
|
|
5316
|
+
var serializedType = serializeData(type);
|
|
5317
|
+
var size = serializeData(payload.byteLength);
|
|
5318
|
+
resultSeiList.push(serializedType, size, payload);
|
|
5319
|
+
}
|
|
5320
|
+
} catch (err) {
|
|
5321
|
+
_iterator.e(err);
|
|
5322
|
+
} finally {
|
|
5323
|
+
_iterator.f();
|
|
5324
|
+
}
|
|
5325
|
+
var resultLength = resultSeiList.reduce(function(pre, cur) {
|
|
5326
|
+
return pre + cur.byteLength;
|
|
5327
|
+
}, 0);
|
|
5328
|
+
var result = new Uint8Array(resultLength);
|
|
5329
|
+
resultSeiList.reduce(function(pre, cur) {
|
|
5330
|
+
result.set(cur, pre);
|
|
5331
|
+
return pre + cur.byteLength;
|
|
5332
|
+
}, 0);
|
|
5333
|
+
return result;
|
|
5334
|
+
}
|
|
5335
|
+
}]);
|
|
5336
|
+
return SEIHelper2;
|
|
5337
|
+
}();
|
|
5338
|
+
var Nalunit = /* @__PURE__ */ function() {
|
|
5339
|
+
function Nalunit2() {
|
|
5340
|
+
_classCallCheck$2(this, Nalunit2);
|
|
5341
|
+
}
|
|
5342
|
+
_createClass$2(Nalunit2, null, [{
|
|
5343
|
+
key: "getNalunits",
|
|
5344
|
+
value: function getNalunits(buffer) {
|
|
5345
|
+
if (buffer.length - buffer.position < 4) {
|
|
5346
|
+
return [];
|
|
5347
|
+
}
|
|
5348
|
+
var position = buffer.position;
|
|
5349
|
+
if (buffer.getInt32(position) === 1 || buffer.getInt16(position) === 0 && buffer.getInt8(position + 2) === 1) {
|
|
5350
|
+
return Nalunit2.getAnnexbNals(buffer);
|
|
5351
|
+
} else {
|
|
5352
|
+
return Nalunit2.getAvccNals(buffer);
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
}, {
|
|
5356
|
+
key: "getAnnexbNals",
|
|
5357
|
+
value: function getAnnexbNals(buffer) {
|
|
5358
|
+
var nals = [];
|
|
5359
|
+
var position = Nalunit2.getHeaderPositionAnnexB(buffer);
|
|
5360
|
+
var start = position.pos;
|
|
5361
|
+
var end = start;
|
|
5362
|
+
while (start < buffer.length - 4) {
|
|
5363
|
+
var header = new Uint8Array(buffer.buffer.slice(start, start + position.headerLength));
|
|
5364
|
+
if (position.pos === buffer.position) {
|
|
5365
|
+
buffer.skip(position.headerLength);
|
|
5366
|
+
}
|
|
5367
|
+
position = Nalunit2.getHeaderPositionAnnexB(buffer);
|
|
5368
|
+
end = position.pos;
|
|
5369
|
+
var body = new Uint8Array(buffer.buffer.slice(start + header.byteLength, end));
|
|
5370
|
+
var unit = {
|
|
5371
|
+
header,
|
|
5372
|
+
body,
|
|
5373
|
+
type: -1
|
|
5374
|
+
};
|
|
5375
|
+
Nalunit2.analyseNal(unit);
|
|
5376
|
+
if (unit.type <= 9 && unit.type !== 0) {
|
|
5377
|
+
nals.push(unit);
|
|
5378
|
+
}
|
|
5379
|
+
buffer.skip(end - buffer.position);
|
|
5380
|
+
start = end;
|
|
5381
|
+
}
|
|
5382
|
+
return nals;
|
|
5383
|
+
}
|
|
5384
|
+
}, {
|
|
5385
|
+
key: "getAvccNals",
|
|
5386
|
+
value: function getAvccNals(buffer) {
|
|
5387
|
+
var nals = [];
|
|
5388
|
+
while (buffer.position < buffer.length - 4) {
|
|
5389
|
+
var length = buffer.getInt32(buffer.position);
|
|
5390
|
+
if (buffer.length - buffer.position >= length) {
|
|
5391
|
+
var header = new Uint8Array(buffer.buffer.slice(buffer.position, buffer.position + 4));
|
|
5392
|
+
buffer.skip(4);
|
|
5393
|
+
var body = new Uint8Array(buffer.buffer.slice(buffer.position, buffer.position + length));
|
|
5394
|
+
buffer.skip(length);
|
|
5395
|
+
var unit = {
|
|
5396
|
+
header,
|
|
5397
|
+
body,
|
|
5398
|
+
type: -1
|
|
5399
|
+
};
|
|
5400
|
+
Nalunit2.analyseNal(unit);
|
|
5401
|
+
if (unit.type <= 9 && unit.type !== 0) {
|
|
5402
|
+
nals.push(unit);
|
|
5403
|
+
}
|
|
5404
|
+
} else {
|
|
5405
|
+
break;
|
|
5406
|
+
}
|
|
5407
|
+
}
|
|
5408
|
+
return nals;
|
|
5409
|
+
}
|
|
5410
|
+
}, {
|
|
5411
|
+
key: "analyseNal",
|
|
5412
|
+
value: function analyseNal(unit) {
|
|
5413
|
+
var type = unit.body[0] & 31;
|
|
5414
|
+
unit.type = type;
|
|
5415
|
+
switch (type) {
|
|
5416
|
+
case 1:
|
|
5417
|
+
unit.ndr = true;
|
|
5418
|
+
break;
|
|
5419
|
+
case 5:
|
|
5420
|
+
unit.idr = true;
|
|
5421
|
+
break;
|
|
5422
|
+
case 6:
|
|
5423
|
+
unit.sei = true;
|
|
5424
|
+
break;
|
|
5425
|
+
case 7:
|
|
5426
|
+
unit.sps = true;
|
|
5427
|
+
break;
|
|
5428
|
+
case 8:
|
|
5429
|
+
unit.pps = true;
|
|
5430
|
+
break;
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
}, {
|
|
5434
|
+
key: "getHeaderPositionAnnexB",
|
|
5435
|
+
value: function getHeaderPositionAnnexB(buffer) {
|
|
5436
|
+
var pos = buffer.position;
|
|
5437
|
+
var headerLength = 0;
|
|
5438
|
+
var bufferLen = buffer.length;
|
|
5439
|
+
while (headerLength !== 3 && headerLength !== 4 && pos < bufferLen - 4) {
|
|
5440
|
+
if (buffer.getInt16(pos) === 0) {
|
|
5441
|
+
if (buffer.getInt16(pos + 2) === 1) {
|
|
5442
|
+
headerLength = 4;
|
|
5443
|
+
} else if (buffer.getInt8(pos + 2) === 1) {
|
|
5444
|
+
headerLength = 3;
|
|
5445
|
+
} else {
|
|
5446
|
+
pos++;
|
|
5447
|
+
}
|
|
5448
|
+
} else {
|
|
5449
|
+
pos++;
|
|
5450
|
+
}
|
|
5451
|
+
}
|
|
5452
|
+
if (pos === bufferLen - 4) {
|
|
5453
|
+
if (buffer.getInt16(pos) === 0) {
|
|
5454
|
+
if (buffer.getInt16(pos + 2) === 1) {
|
|
5455
|
+
headerLength = 4;
|
|
5456
|
+
} else {
|
|
5457
|
+
pos = bufferLen;
|
|
5458
|
+
}
|
|
5459
|
+
} else {
|
|
5460
|
+
pos++;
|
|
5461
|
+
if (buffer.getInt16(pos) === 0 && buffer.getInt8(pos) === 1) {
|
|
5462
|
+
headerLength = 3;
|
|
5463
|
+
} else {
|
|
5464
|
+
pos = bufferLen;
|
|
5465
|
+
}
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
return {
|
|
5469
|
+
pos,
|
|
5470
|
+
headerLength
|
|
5471
|
+
};
|
|
5472
|
+
}
|
|
5473
|
+
}]);
|
|
5474
|
+
return Nalunit2;
|
|
5475
|
+
}();
|
|
5476
|
+
var RTCDataView = /* @__PURE__ */ function() {
|
|
5477
|
+
function RTCDataView2(buffer) {
|
|
5478
|
+
_classCallCheck$2(this, RTCDataView2);
|
|
5479
|
+
this._position = 0;
|
|
5480
|
+
this._dataview = new DataView(buffer);
|
|
5481
|
+
}
|
|
5482
|
+
_createClass$2(RTCDataView2, [{
|
|
5483
|
+
key: "length",
|
|
5484
|
+
get: function get() {
|
|
5485
|
+
return this.buffer.byteLength;
|
|
5486
|
+
}
|
|
5487
|
+
}, {
|
|
5488
|
+
key: "buffer",
|
|
5489
|
+
get: function get() {
|
|
5490
|
+
return this._dataview.buffer;
|
|
5491
|
+
}
|
|
5492
|
+
}, {
|
|
5493
|
+
key: "position",
|
|
5494
|
+
get: function get() {
|
|
5495
|
+
return this._position;
|
|
5496
|
+
},
|
|
5497
|
+
set: function set(value) {
|
|
5498
|
+
this._position = value;
|
|
5499
|
+
}
|
|
5500
|
+
}, {
|
|
5501
|
+
key: "back",
|
|
5502
|
+
value: function back(count) {
|
|
5503
|
+
this.position -= count;
|
|
5504
|
+
}
|
|
5505
|
+
}, {
|
|
5506
|
+
key: "getUint8",
|
|
5507
|
+
value: function getUint8(offset) {
|
|
5508
|
+
return this._dataview.getUint8(offset);
|
|
5509
|
+
}
|
|
5510
|
+
}, {
|
|
5511
|
+
key: "getInt8",
|
|
5512
|
+
value: function getInt8(offset) {
|
|
5513
|
+
return this._dataview.getInt8(offset);
|
|
5514
|
+
}
|
|
5515
|
+
}, {
|
|
5516
|
+
key: "getInt16",
|
|
5517
|
+
value: function getInt16(offset) {
|
|
5518
|
+
return this._dataview.getInt16(offset);
|
|
5519
|
+
}
|
|
5520
|
+
}, {
|
|
5521
|
+
key: "getUint16",
|
|
5522
|
+
value: function getUint16(offset) {
|
|
5523
|
+
return this._dataview.getUint16(offset);
|
|
5524
|
+
}
|
|
5525
|
+
}, {
|
|
5526
|
+
key: "getUint32",
|
|
5527
|
+
value: function getUint32(offset) {
|
|
5528
|
+
return this._dataview.getUint32(offset);
|
|
5529
|
+
}
|
|
5530
|
+
}, {
|
|
5531
|
+
key: "getInt32",
|
|
5532
|
+
value: function getInt32(offset) {
|
|
5533
|
+
return this._dataview.getInt32(offset);
|
|
5534
|
+
}
|
|
5535
|
+
}, {
|
|
5536
|
+
key: "skip",
|
|
5537
|
+
value: function skip(count) {
|
|
5538
|
+
var loop = Math.floor(count / 4);
|
|
5539
|
+
var last = count % 4;
|
|
5540
|
+
for (var i = 0; i < loop; i++) {
|
|
5541
|
+
RTCDataView2.readByte(this, 4);
|
|
5542
|
+
}
|
|
5543
|
+
if (last > 0) {
|
|
5544
|
+
RTCDataView2.readByte(this, last);
|
|
5545
|
+
}
|
|
5546
|
+
}
|
|
5547
|
+
}, {
|
|
5548
|
+
key: "readUint8",
|
|
5549
|
+
value: function readUint8() {
|
|
5550
|
+
return RTCDataView2.readByte(this, 1);
|
|
5551
|
+
}
|
|
5552
|
+
}, {
|
|
5553
|
+
key: "readUint16",
|
|
5554
|
+
value: function readUint16() {
|
|
5555
|
+
return RTCDataView2.readByte(this, 2);
|
|
5556
|
+
}
|
|
5557
|
+
}, {
|
|
5558
|
+
key: "readUint24",
|
|
5559
|
+
value: function readUint24() {
|
|
5560
|
+
return RTCDataView2.readByte(this, 3);
|
|
5561
|
+
}
|
|
5562
|
+
}, {
|
|
5563
|
+
key: "readUint32",
|
|
5564
|
+
value: function readUint32() {
|
|
5565
|
+
return RTCDataView2.readByte(this, 4);
|
|
5566
|
+
}
|
|
5567
|
+
}, {
|
|
5568
|
+
key: "readUint64",
|
|
5569
|
+
value: function readUint64() {
|
|
5570
|
+
return RTCDataView2.readByte(this, 8);
|
|
5571
|
+
}
|
|
5572
|
+
}, {
|
|
5573
|
+
key: "readInt8",
|
|
5574
|
+
value: function readInt8() {
|
|
5575
|
+
return RTCDataView2.readByte(this, 1, true);
|
|
5576
|
+
}
|
|
5577
|
+
}, {
|
|
5578
|
+
key: "readInt16",
|
|
5579
|
+
value: function readInt16() {
|
|
5580
|
+
return RTCDataView2.readByte(this, 2, true);
|
|
5581
|
+
}
|
|
5582
|
+
}, {
|
|
5583
|
+
key: "readInt32",
|
|
5584
|
+
value: function readInt32() {
|
|
5585
|
+
return RTCDataView2.readByte(this, 4, true);
|
|
5586
|
+
}
|
|
5587
|
+
}, {
|
|
5588
|
+
key: "writeUint32",
|
|
5589
|
+
value: function writeUint32(value) {
|
|
5590
|
+
return new Uint8Array([value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255]);
|
|
5591
|
+
}
|
|
5592
|
+
}], [{
|
|
5593
|
+
key: "readByte",
|
|
5594
|
+
value: function readByte(buffer, size, sign) {
|
|
5595
|
+
var res;
|
|
5596
|
+
switch (size) {
|
|
5597
|
+
case 1:
|
|
5598
|
+
if (sign) {
|
|
5599
|
+
res = buffer.getInt8(buffer.position);
|
|
5600
|
+
} else {
|
|
5601
|
+
res = buffer.getUint8(buffer.position);
|
|
5602
|
+
}
|
|
5603
|
+
break;
|
|
5604
|
+
case 2:
|
|
5605
|
+
if (sign) {
|
|
5606
|
+
res = buffer.getInt16(buffer.position);
|
|
5607
|
+
} else {
|
|
5608
|
+
res = buffer.getUint16(buffer.position);
|
|
5609
|
+
}
|
|
5610
|
+
break;
|
|
5611
|
+
case 3:
|
|
5612
|
+
if (sign) {
|
|
5613
|
+
throw new Error("not supported for readByte 3");
|
|
5614
|
+
} else {
|
|
5615
|
+
res = buffer.getUint8(buffer.position) << 16;
|
|
5616
|
+
res |= buffer.getUint8(buffer.position + 1) << 8;
|
|
5617
|
+
res |= buffer.getUint8(buffer.position + 2);
|
|
5618
|
+
}
|
|
5619
|
+
break;
|
|
5620
|
+
case 4:
|
|
5621
|
+
if (sign) {
|
|
5622
|
+
res = buffer.getInt32(buffer.position);
|
|
5623
|
+
} else {
|
|
5624
|
+
res = buffer.getUint32(buffer.position);
|
|
5625
|
+
}
|
|
5626
|
+
break;
|
|
5627
|
+
case 8:
|
|
5628
|
+
if (sign) {
|
|
5629
|
+
throw new Error("not supported for readBody 8");
|
|
5630
|
+
} else {
|
|
5631
|
+
res = buffer.getUint32(buffer.position) << 32;
|
|
5632
|
+
res |= buffer.getUint32(buffer.position + 4);
|
|
5633
|
+
}
|
|
5634
|
+
break;
|
|
5635
|
+
default:
|
|
5636
|
+
res = "";
|
|
5637
|
+
}
|
|
5638
|
+
buffer.position += size;
|
|
5639
|
+
return res;
|
|
5640
|
+
}
|
|
5641
|
+
}]);
|
|
5642
|
+
return RTCDataView2;
|
|
5643
|
+
}();
|
|
5644
|
+
function isSupported() {
|
|
5645
|
+
if (!window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver) {
|
|
5646
|
+
return false;
|
|
5647
|
+
}
|
|
5648
|
+
return true;
|
|
5649
|
+
}
|
|
5650
|
+
function getCapacity() {
|
|
5651
|
+
if (!isSupported())
|
|
5652
|
+
return Promise.reject("RTCPeerConnection no support");
|
|
5653
|
+
var pc;
|
|
5654
|
+
try {
|
|
5655
|
+
pc = new RTCPeerConnection();
|
|
5656
|
+
pc.addTransceiver("video", {
|
|
5657
|
+
direction: "recvonly"
|
|
5658
|
+
});
|
|
5659
|
+
pc.addTransceiver("audio", {
|
|
5660
|
+
direction: "recvonly"
|
|
5661
|
+
});
|
|
5662
|
+
} catch (e) {
|
|
5663
|
+
return Promise.reject(e === null || e === void 0 ? void 0 : e.message);
|
|
5664
|
+
}
|
|
5665
|
+
return pc.createOffer().then(function(offer) {
|
|
5666
|
+
var _sdpJson$media, _sdpJson$media2, _vMedia$rtp, _aMedia$rtp;
|
|
5667
|
+
logger.log(offer.sdp);
|
|
5668
|
+
var sdpJson = lib.parse(offer.sdp);
|
|
5669
|
+
var vMedia = (_sdpJson$media = sdpJson.media) === null || _sdpJson$media === void 0 ? void 0 : _sdpJson$media.filter(function(x) {
|
|
5670
|
+
return x.type === "video";
|
|
5671
|
+
})[0];
|
|
5672
|
+
var aMedia = (_sdpJson$media2 = sdpJson.media) === null || _sdpJson$media2 === void 0 ? void 0 : _sdpJson$media2.filter(function(x) {
|
|
5673
|
+
return x.type === "audio";
|
|
5674
|
+
})[0];
|
|
5675
|
+
var vCodecs = vMedia === null || vMedia === void 0 ? void 0 : (_vMedia$rtp = vMedia.rtp) === null || _vMedia$rtp === void 0 ? void 0 : _vMedia$rtp.filter(function(x) {
|
|
5676
|
+
return x.codec === "VP8" || x.codec === "VP9" || x.codec === "H264";
|
|
5677
|
+
});
|
|
5678
|
+
var aCodecs = aMedia === null || aMedia === void 0 ? void 0 : (_aMedia$rtp = aMedia.rtp) === null || _aMedia$rtp === void 0 ? void 0 : _aMedia$rtp.filter(function(x) {
|
|
5679
|
+
return x.codec === "opus";
|
|
5680
|
+
});
|
|
5681
|
+
var vFmtp = vMedia === null || vMedia === void 0 ? void 0 : vMedia.fmtp;
|
|
5682
|
+
var aFmtp = aMedia === null || aMedia === void 0 ? void 0 : aMedia.fmtp;
|
|
5683
|
+
vFmtp && vCodecs.map(function(codec) {
|
|
5684
|
+
var _vFmtp$filter$;
|
|
5685
|
+
codec.config = (_vFmtp$filter$ = vFmtp.filter(function(x) {
|
|
5686
|
+
return x.payload === codec.payload;
|
|
5687
|
+
})[0]) === null || _vFmtp$filter$ === void 0 ? void 0 : _vFmtp$filter$.config;
|
|
5688
|
+
});
|
|
5689
|
+
aFmtp && aCodecs.map(function(codec) {
|
|
5690
|
+
var _aFmtp$filter$;
|
|
5691
|
+
codec.config = (_aFmtp$filter$ = aFmtp.filter(function(x) {
|
|
5692
|
+
return x.payload === codec.payload;
|
|
5693
|
+
})[0]) === null || _aFmtp$filter$ === void 0 ? void 0 : _aFmtp$filter$.config;
|
|
5694
|
+
});
|
|
5695
|
+
pc.close();
|
|
5696
|
+
return {
|
|
5697
|
+
video: vCodecs,
|
|
5698
|
+
audio: aCodecs
|
|
5699
|
+
};
|
|
5700
|
+
});
|
|
5701
|
+
}
|
|
5702
|
+
var isEncodedTransformSupported = function isEncodedTransformSupported2() {
|
|
5703
|
+
return typeof TransformStream !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
|
|
5704
|
+
};
|
|
5068
5705
|
var logger = new Logger("rts");
|
|
5069
5706
|
var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
5070
5707
|
_inherits$1(Rts2, _EventEmitter);
|
|
@@ -5280,6 +5917,37 @@
|
|
|
5280
5917
|
this._mediaStream.addTrack(this._audio);
|
|
5281
5918
|
this._mediaStream.addTrack(this._video);
|
|
5282
5919
|
}
|
|
5920
|
+
}, {
|
|
5921
|
+
key: "initVideoEncodedTransform",
|
|
5922
|
+
value: function initVideoEncodedTransform() {
|
|
5923
|
+
var _this4 = this;
|
|
5924
|
+
if (!this._videoTransceicer || !this._videoTransceicer.receiver) {
|
|
5925
|
+
console.log("no receiver found when trying to bind encodedTransform");
|
|
5926
|
+
return;
|
|
5927
|
+
}
|
|
5928
|
+
var receiver = this._videoTransceicer.receiver;
|
|
5929
|
+
if (isEncodedTransformSupported()) {
|
|
5930
|
+
var _receiver$createEncod = receiver.createEncodedStreams(), readable = _receiver$createEncod.readable, writable = _receiver$createEncod.writable;
|
|
5931
|
+
readable.pipeThrough(new TransformStream({
|
|
5932
|
+
transform: function transform(chunk, controller) {
|
|
5933
|
+
var nals = Nalunit.getNalunits(new RTCDataView(chunk.data));
|
|
5934
|
+
nals.forEach(function(nalUnit) {
|
|
5935
|
+
if (nalUnit.sei) {
|
|
5936
|
+
var decodedSei = SEIHelper.decodeSeiBody(nalUnit.body);
|
|
5937
|
+
if (decodedSei && decodedSei.type !== RTC_SEI_TYPE.internal) {
|
|
5938
|
+
_this4.emit(EVENT.SEI, {
|
|
5939
|
+
sei: {
|
|
5940
|
+
content: decodedSei.payload
|
|
5941
|
+
}
|
|
5942
|
+
});
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
});
|
|
5946
|
+
controller.enqueue(chunk);
|
|
5947
|
+
}
|
|
5948
|
+
})).pipeTo(writable);
|
|
5949
|
+
}
|
|
5950
|
+
}
|
|
5283
5951
|
}, {
|
|
5284
5952
|
key: "_bindMediaEvent",
|
|
5285
5953
|
value: function _bindMediaEvent() {
|
|
@@ -5297,7 +5965,7 @@
|
|
|
5297
5965
|
case 0:
|
|
5298
5966
|
pc = this._pc;
|
|
5299
5967
|
if (!pc.addTransceiver) {
|
|
5300
|
-
_context2.next =
|
|
5968
|
+
_context2.next = 12;
|
|
5301
5969
|
break;
|
|
5302
5970
|
}
|
|
5303
5971
|
this._audioTransceicer = pc.addTransceiver("audio", {
|
|
@@ -5306,6 +5974,7 @@
|
|
|
5306
5974
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
5307
5975
|
direction: "recvonly"
|
|
5308
5976
|
});
|
|
5977
|
+
this.initVideoEncodedTransform();
|
|
5309
5978
|
delayHint = this._opts.delayHint;
|
|
5310
5979
|
if (delayHint) {
|
|
5311
5980
|
this._audioTransceicer.receiver.playoutDelayHint = delayHint;
|
|
@@ -5313,22 +5982,22 @@
|
|
|
5313
5982
|
this._videoTransceicer.receiver.playoutDelayHint = delayHint;
|
|
5314
5983
|
this._videoTransceicer.receiver.jitterBufferDelayHint = delayHint;
|
|
5315
5984
|
}
|
|
5316
|
-
_context2.next =
|
|
5985
|
+
_context2.next = 9;
|
|
5317
5986
|
return pc.createOffer();
|
|
5318
|
-
case
|
|
5987
|
+
case 9:
|
|
5319
5988
|
offer = _context2.sent;
|
|
5320
|
-
_context2.next =
|
|
5989
|
+
_context2.next = 15;
|
|
5321
5990
|
break;
|
|
5322
|
-
case
|
|
5323
|
-
_context2.next =
|
|
5991
|
+
case 12:
|
|
5992
|
+
_context2.next = 14;
|
|
5324
5993
|
return pc.createOffer({
|
|
5325
5994
|
iceRestart: true,
|
|
5326
5995
|
offerToReceiveAudio: true,
|
|
5327
5996
|
offerToReceiveVideo: true
|
|
5328
5997
|
});
|
|
5329
|
-
case 13:
|
|
5330
|
-
offer = _context2.sent;
|
|
5331
5998
|
case 14:
|
|
5999
|
+
offer = _context2.sent;
|
|
6000
|
+
case 15:
|
|
5332
6001
|
logger.log("local offer");
|
|
5333
6002
|
logger.log(offer.sdp);
|
|
5334
6003
|
parsed = lib.parse(offer.sdp);
|
|
@@ -5353,11 +6022,11 @@
|
|
|
5353
6022
|
});
|
|
5354
6023
|
offer.sdp = lib.write(parsed);
|
|
5355
6024
|
logger.log("local offer modified:\n", offer.sdp);
|
|
5356
|
-
_context2.next =
|
|
6025
|
+
_context2.next = 23;
|
|
5357
6026
|
return pc.setLocalDescription(offer);
|
|
5358
|
-
case
|
|
6027
|
+
case 23:
|
|
5359
6028
|
finnalUrl = this._url;
|
|
5360
|
-
_context2.prev =
|
|
6029
|
+
_context2.prev = 24;
|
|
5361
6030
|
if (this._opts.preProcessUrl) {
|
|
5362
6031
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
5363
6032
|
}
|
|
@@ -5370,7 +6039,7 @@
|
|
|
5370
6039
|
sessionId
|
|
5371
6040
|
});
|
|
5372
6041
|
reqStart = Date.now();
|
|
5373
|
-
_context2.next =
|
|
6042
|
+
_context2.next = 33;
|
|
5374
6043
|
return this._loader.load(finnalUrl, {
|
|
5375
6044
|
body: JSON.stringify({
|
|
5376
6045
|
sessionId,
|
|
@@ -5378,27 +6047,27 @@
|
|
|
5378
6047
|
localSdp: offer
|
|
5379
6048
|
})
|
|
5380
6049
|
});
|
|
5381
|
-
case
|
|
6050
|
+
case 33:
|
|
5382
6051
|
res = _context2.sent;
|
|
5383
6052
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
5384
6053
|
headers: res.response.headers
|
|
5385
6054
|
});
|
|
5386
6055
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
5387
6056
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
5388
|
-
_context2.next =
|
|
6057
|
+
_context2.next = 41;
|
|
5389
6058
|
break;
|
|
5390
6059
|
}
|
|
5391
6060
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
5392
6061
|
err.errorType = ERR.NETWORK;
|
|
5393
6062
|
this._emitError(err);
|
|
5394
6063
|
return _context2.abrupt("return");
|
|
5395
|
-
case
|
|
6064
|
+
case 41:
|
|
5396
6065
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
5397
|
-
_context2.next =
|
|
6066
|
+
_context2.next = 43;
|
|
5398
6067
|
break;
|
|
5399
6068
|
}
|
|
5400
6069
|
throw new Error("code: ".concat(answer === null || answer === void 0 ? void 0 : answer.code, ", message:").concat(answer === null || answer === void 0 ? void 0 : answer.message));
|
|
5401
|
-
case
|
|
6070
|
+
case 43:
|
|
5402
6071
|
logger.log("answer:");
|
|
5403
6072
|
logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
5404
6073
|
this.emit(EVENT.LOAD_COMPLETE, {
|
|
@@ -5413,21 +6082,21 @@
|
|
|
5413
6082
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
5414
6083
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
5415
6084
|
this._rctConnectStartTs = Date.now();
|
|
5416
|
-
_context2.next =
|
|
6085
|
+
_context2.next = 53;
|
|
5417
6086
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
5418
|
-
case
|
|
6087
|
+
case 53:
|
|
5419
6088
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
5420
|
-
_context2.next =
|
|
6089
|
+
_context2.next = 59;
|
|
5421
6090
|
break;
|
|
5422
|
-
case
|
|
5423
|
-
_context2.prev =
|
|
5424
|
-
_context2.t0 = _context2["catch"](
|
|
6091
|
+
case 56:
|
|
6092
|
+
_context2.prev = 56;
|
|
6093
|
+
_context2.t0 = _context2["catch"](24);
|
|
5425
6094
|
this._emitError(StreamingError.network(_context2.t0));
|
|
5426
|
-
case
|
|
6095
|
+
case 59:
|
|
5427
6096
|
case "end":
|
|
5428
6097
|
return _context2.stop();
|
|
5429
6098
|
}
|
|
5430
|
-
}, _callee2, this, [[
|
|
6099
|
+
}, _callee2, this, [[24, 56]]);
|
|
5431
6100
|
}));
|
|
5432
6101
|
function _connect() {
|
|
5433
6102
|
return _connect2.apply(this, arguments);
|
|
@@ -5489,64 +6158,6 @@
|
|
|
5489
6158
|
}
|
|
5490
6159
|
} catch (error) {
|
|
5491
6160
|
}
|
|
5492
|
-
function isSupported() {
|
|
5493
|
-
if (!window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver) {
|
|
5494
|
-
return false;
|
|
5495
|
-
}
|
|
5496
|
-
return true;
|
|
5497
|
-
}
|
|
5498
|
-
function getCapacity() {
|
|
5499
|
-
if (!isSupported())
|
|
5500
|
-
return Promise.reject("RTCPeerConnection no support");
|
|
5501
|
-
var pc;
|
|
5502
|
-
try {
|
|
5503
|
-
pc = new RTCPeerConnection();
|
|
5504
|
-
pc.addTransceiver("video", {
|
|
5505
|
-
direction: "recvonly"
|
|
5506
|
-
});
|
|
5507
|
-
pc.addTransceiver("audio", {
|
|
5508
|
-
direction: "recvonly"
|
|
5509
|
-
});
|
|
5510
|
-
} catch (e) {
|
|
5511
|
-
return Promise.reject(e === null || e === void 0 ? void 0 : e.message);
|
|
5512
|
-
}
|
|
5513
|
-
return pc.createOffer().then(function(offer) {
|
|
5514
|
-
var _sdpJson$media, _sdpJson$media2, _vMedia$rtp, _aMedia$rtp;
|
|
5515
|
-
logger.log(offer.sdp);
|
|
5516
|
-
var sdpJson = lib.parse(offer.sdp);
|
|
5517
|
-
var vMedia = (_sdpJson$media = sdpJson.media) === null || _sdpJson$media === void 0 ? void 0 : _sdpJson$media.filter(function(x) {
|
|
5518
|
-
return x.type === "video";
|
|
5519
|
-
})[0];
|
|
5520
|
-
var aMedia = (_sdpJson$media2 = sdpJson.media) === null || _sdpJson$media2 === void 0 ? void 0 : _sdpJson$media2.filter(function(x) {
|
|
5521
|
-
return x.type === "audio";
|
|
5522
|
-
})[0];
|
|
5523
|
-
var vCodecs = vMedia === null || vMedia === void 0 ? void 0 : (_vMedia$rtp = vMedia.rtp) === null || _vMedia$rtp === void 0 ? void 0 : _vMedia$rtp.filter(function(x) {
|
|
5524
|
-
return x.codec === "VP8" || x.codec === "VP9" || x.codec === "H264";
|
|
5525
|
-
});
|
|
5526
|
-
var aCodecs = aMedia === null || aMedia === void 0 ? void 0 : (_aMedia$rtp = aMedia.rtp) === null || _aMedia$rtp === void 0 ? void 0 : _aMedia$rtp.filter(function(x) {
|
|
5527
|
-
return x.codec === "opus";
|
|
5528
|
-
});
|
|
5529
|
-
var vFmtp = vMedia === null || vMedia === void 0 ? void 0 : vMedia.fmtp;
|
|
5530
|
-
var aFmtp = aMedia === null || aMedia === void 0 ? void 0 : aMedia.fmtp;
|
|
5531
|
-
vFmtp && vCodecs.map(function(codec) {
|
|
5532
|
-
var _vFmtp$filter$;
|
|
5533
|
-
codec.config = (_vFmtp$filter$ = vFmtp.filter(function(x) {
|
|
5534
|
-
return x.payload === codec.payload;
|
|
5535
|
-
})[0]) === null || _vFmtp$filter$ === void 0 ? void 0 : _vFmtp$filter$.config;
|
|
5536
|
-
});
|
|
5537
|
-
aFmtp && aCodecs.map(function(codec) {
|
|
5538
|
-
var _aFmtp$filter$;
|
|
5539
|
-
codec.config = (_aFmtp$filter$ = aFmtp.filter(function(x) {
|
|
5540
|
-
return x.payload === codec.payload;
|
|
5541
|
-
})[0]) === null || _aFmtp$filter$ === void 0 ? void 0 : _aFmtp$filter$.config;
|
|
5542
|
-
});
|
|
5543
|
-
pc.close();
|
|
5544
|
-
return {
|
|
5545
|
-
video: vCodecs,
|
|
5546
|
-
audio: aCodecs
|
|
5547
|
-
};
|
|
5548
|
-
});
|
|
5549
|
-
}
|
|
5550
6161
|
var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
5551
6162
|
_inherits$1(RtsPlugin2, _BasePlugin);
|
|
5552
6163
|
var _super = _createSuper$1(RtsPlugin2);
|
|
@@ -5642,7 +6253,7 @@
|
|
|
5642
6253
|
}, {
|
|
5643
6254
|
key: "version",
|
|
5644
6255
|
get: function get() {
|
|
5645
|
-
return "0.2.1-alpha.
|
|
6256
|
+
return "0.2.1-alpha.5";
|
|
5646
6257
|
}
|
|
5647
6258
|
}, {
|
|
5648
6259
|
key: "beforePlayerInit",
|
|
@@ -5670,6 +6281,7 @@
|
|
|
5670
6281
|
this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS);
|
|
5671
6282
|
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
5672
6283
|
this._transCoreEvent(EVENT.METADATA_PARSED);
|
|
6284
|
+
this._transCoreEvent(EVENT.SEI);
|
|
5673
6285
|
this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);
|
|
5674
6286
|
try {
|
|
5675
6287
|
BasePlugin.defineGetterOrSetter(this.player, {
|