@besovideo/webrtc-player 0.8.62 → 0.8.63

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.
@@ -10354,7 +10354,7 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
10354
10354
  }
10355
10355
  function combinaWebM(webM1, webM2) {
10356
10356
  return __async(this, null, function* () {
10357
- var _a, _b;
10357
+ var _a, _b, _c, _d, _e;
10358
10358
  const stream0 = webM1 ? yield GetDemuxer(webM1) : webM1;
10359
10359
  const stream1 = webM2 ? yield GetDemuxer(webM2) : webM2;
10360
10360
  let audio;
@@ -10362,13 +10362,13 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
10362
10362
  if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "audio") {
10363
10363
  audio = stream0;
10364
10364
  }
10365
- if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "audio") {
10365
+ if (((_a = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _a.type) == "audio") {
10366
10366
  audio = stream1;
10367
10367
  }
10368
- if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "video") {
10368
+ if (((_b = stream0 == null ? void 0 : stream0.tracks[1]) == null ? void 0 : _b.type) == "video") {
10369
10369
  video = stream0;
10370
10370
  }
10371
- if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "video") {
10371
+ if (((_c = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _c.type) == "video") {
10372
10372
  video = stream1;
10373
10373
  }
10374
10374
  const videoTrackInfo = video == null ? void 0 : video.tracks[1];
@@ -10393,22 +10393,30 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
10393
10393
  streaming: false
10394
10394
  }));
10395
10395
  const parser = SimpleBlockParser();
10396
- video == null ? void 0 : video.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
10396
+ video == null ? void 0 : video.elements.filter((item) => item.type == "b" || item.name == "BlockGroup").forEach((simpleBlock) => {
10397
+ if (simpleBlock.name == "BlockGroup") {
10398
+ const tempBlock = simpleBlock.childs.find((item) => item.type == "b");
10399
+ if (tempBlock) {
10400
+ simpleBlock = tempBlock;
10401
+ }
10402
+ }
10397
10403
  const [timestamp, data, bKeyFrame] = parser.parse(simpleBlock, 0);
10398
10404
  muxer.addVideoChunkRaw(data, bKeyFrame ? "key" : "delta", timestamp);
10399
10405
  });
10400
- const audioCodecPrivate = (_b = (_a = audio == null ? void 0 : audio.elements.find((item) => item.name == "Tracks")) == null ? void 0 : _a.childs[0].childs.find((item) => item.name == "CodecPrivate")) == null ? void 0 : _b.data;
10401
- const config = {
10402
- decoderConfig: {
10403
- sampleRate: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).SamplingFrequency,
10404
- numberOfChannels: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).Channels,
10405
- description: audioCodecPrivate
10406
- }
10407
- };
10408
- audio == null ? void 0 : audio.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
10409
- const [timestamp, data] = parser.parse(simpleBlock, 1);
10410
- muxer.addAudioChunkRaw(data, "key", timestamp, config);
10411
- });
10406
+ if (audio) {
10407
+ const audioCodecPrivate = (_e = (_d = audio == null ? void 0 : audio.elements.find((item) => item.name == "Tracks")) == null ? void 0 : _d.childs[0].childs.find((item) => item.name == "CodecPrivate")) == null ? void 0 : _e.data;
10408
+ const config = {
10409
+ decoderConfig: {
10410
+ sampleRate: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).SamplingFrequency,
10411
+ numberOfChannels: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).Channels,
10412
+ description: audioCodecPrivate
10413
+ }
10414
+ };
10415
+ audio == null ? void 0 : audio.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
10416
+ const [timestamp, data] = parser.parse(simpleBlock, 1);
10417
+ muxer.addAudioChunkRaw(data, "key", timestamp, config);
10418
+ });
10419
+ }
10412
10420
  muxer.finalize();
10413
10421
  return new Blob([muxer.target.buffer]);
10414
10422
  });
@@ -10448,13 +10456,17 @@ If you want to allow non-zero first timestamps, set firstTimestampBehavior: 'per
10448
10456
  return mediaRecorder;
10449
10457
  };
10450
10458
  var createRecord = (_mediaStream, fileName) => {
10451
- const mediaStreams = _mediaStream.getTracks().map((item) => {
10459
+ const tempMediaStreams = _mediaStream.getTracks().map((item) => {
10452
10460
  const mediaStream2 = new MediaStream([item]);
10453
10461
  item.addEventListener("ended", () => {
10454
10462
  mediaStream2.getTracks().forEach((item2) => item2.stop());
10455
10463
  });
10456
10464
  return new MediaStream([item]);
10457
10465
  });
10466
+ const mediaStreams = [
10467
+ ...tempMediaStreams.filter((item) => item.getVideoTracks().length > 0),
10468
+ ...tempMediaStreams.filter((item) => item.getAudioTracks().length > 0)
10469
+ ];
10458
10470
  const mediaStream = mediaStreams[0];
10459
10471
  let recordedChunks = [];
10460
10472
  const szWebM = [];
package/dist/main.es.js CHANGED
@@ -10340,7 +10340,7 @@ function SimpleBlockParser() {
10340
10340
  }
10341
10341
  function combinaWebM(webM1, webM2) {
10342
10342
  return __async(this, null, function* () {
10343
- var _a, _b;
10343
+ var _a, _b, _c, _d, _e;
10344
10344
  const stream0 = webM1 ? yield GetDemuxer(webM1) : webM1;
10345
10345
  const stream1 = webM2 ? yield GetDemuxer(webM2) : webM2;
10346
10346
  let audio;
@@ -10348,13 +10348,13 @@ function combinaWebM(webM1, webM2) {
10348
10348
  if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "audio") {
10349
10349
  audio = stream0;
10350
10350
  }
10351
- if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "audio") {
10351
+ if (((_a = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _a.type) == "audio") {
10352
10352
  audio = stream1;
10353
10353
  }
10354
- if ((stream0 == null ? void 0 : stream0.tracks[1].type) == "video") {
10354
+ if (((_b = stream0 == null ? void 0 : stream0.tracks[1]) == null ? void 0 : _b.type) == "video") {
10355
10355
  video = stream0;
10356
10356
  }
10357
- if ((stream1 == null ? void 0 : stream1.tracks[1].type) == "video") {
10357
+ if (((_c = stream1 == null ? void 0 : stream1.tracks[1]) == null ? void 0 : _c.type) == "video") {
10358
10358
  video = stream1;
10359
10359
  }
10360
10360
  const videoTrackInfo = video == null ? void 0 : video.tracks[1];
@@ -10379,22 +10379,30 @@ function combinaWebM(webM1, webM2) {
10379
10379
  streaming: false
10380
10380
  }));
10381
10381
  const parser = SimpleBlockParser();
10382
- video == null ? void 0 : video.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
10382
+ video == null ? void 0 : video.elements.filter((item) => item.type == "b" || item.name == "BlockGroup").forEach((simpleBlock) => {
10383
+ if (simpleBlock.name == "BlockGroup") {
10384
+ const tempBlock = simpleBlock.childs.find((item) => item.type == "b");
10385
+ if (tempBlock) {
10386
+ simpleBlock = tempBlock;
10387
+ }
10388
+ }
10383
10389
  const [timestamp, data, bKeyFrame] = parser.parse(simpleBlock, 0);
10384
10390
  muxer.addVideoChunkRaw(data, bKeyFrame ? "key" : "delta", timestamp);
10385
10391
  });
10386
- const audioCodecPrivate = (_b = (_a = audio == null ? void 0 : audio.elements.find((item) => item.name == "Tracks")) == null ? void 0 : _a.childs[0].childs.find((item) => item.name == "CodecPrivate")) == null ? void 0 : _b.data;
10387
- const config = {
10388
- decoderConfig: {
10389
- sampleRate: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).SamplingFrequency,
10390
- numberOfChannels: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).Channels,
10391
- description: audioCodecPrivate
10392
- }
10393
- };
10394
- audio == null ? void 0 : audio.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
10395
- const [timestamp, data] = parser.parse(simpleBlock, 1);
10396
- muxer.addAudioChunkRaw(data, "key", timestamp, config);
10397
- });
10392
+ if (audio) {
10393
+ const audioCodecPrivate = (_e = (_d = audio == null ? void 0 : audio.elements.find((item) => item.name == "Tracks")) == null ? void 0 : _d.childs[0].childs.find((item) => item.name == "CodecPrivate")) == null ? void 0 : _e.data;
10394
+ const config = {
10395
+ decoderConfig: {
10396
+ sampleRate: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).SamplingFrequency,
10397
+ numberOfChannels: (audioTrackInfo == null ? void 0 : audioTrackInfo.metadata).Channels,
10398
+ description: audioCodecPrivate
10399
+ }
10400
+ };
10401
+ audio == null ? void 0 : audio.elements.filter((item) => item.type == "b").forEach((simpleBlock) => {
10402
+ const [timestamp, data] = parser.parse(simpleBlock, 1);
10403
+ muxer.addAudioChunkRaw(data, "key", timestamp, config);
10404
+ });
10405
+ }
10398
10406
  muxer.finalize();
10399
10407
  return new Blob([muxer.target.buffer]);
10400
10408
  });
@@ -10434,13 +10442,17 @@ var createMediaRecorder = (mediaStream, done, mediaRecorderPartner) => {
10434
10442
  return mediaRecorder;
10435
10443
  };
10436
10444
  var createRecord = (_mediaStream, fileName) => {
10437
- const mediaStreams = _mediaStream.getTracks().map((item) => {
10445
+ const tempMediaStreams = _mediaStream.getTracks().map((item) => {
10438
10446
  const mediaStream2 = new MediaStream([item]);
10439
10447
  item.addEventListener("ended", () => {
10440
10448
  mediaStream2.getTracks().forEach((item2) => item2.stop());
10441
10449
  });
10442
10450
  return new MediaStream([item]);
10443
10451
  });
10452
+ const mediaStreams = [
10453
+ ...tempMediaStreams.filter((item) => item.getVideoTracks().length > 0),
10454
+ ...tempMediaStreams.filter((item) => item.getAudioTracks().length > 0)
10455
+ ];
10444
10456
  const mediaStream = mediaStreams[0];
10445
10457
  let recordedChunks = [];
10446
10458
  const szWebM = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.8.62",
3
+ "version": "0.8.63",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",