@flashphoner/websdk 2.0.235 → 2.0.237

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.
Files changed (29) hide show
  1. package/docTemplate/README.md +1 -1
  2. package/examples/demo/dependencies/js/utils.js +78 -19
  3. package/examples/demo/streaming/hls-player/hls-player.html +17 -4
  4. package/examples/demo/streaming/hls-player/hls-player.js +177 -54
  5. package/examples/demo/streaming/hls-player/player-page.html +6 -4
  6. package/examples/demo/streaming/hls-player/{video.js → videojs7/video.js} +16 -6
  7. package/examples/demo/streaming/hls-player/{video.min.js → videojs7/video.min.js} +3 -3
  8. package/examples/demo/streaming/hls-player/videojs8/video-js.css +1946 -0
  9. package/examples/demo/streaming/hls-player/videojs8/video.js +64556 -0
  10. package/examples/demo/streaming/hls-player/videojs8/video.min.js +46 -0
  11. package/flashphoner-no-flash.js +48 -23
  12. package/flashphoner-no-flash.min.js +2 -2
  13. package/flashphoner-no-webrtc.js +3 -10
  14. package/flashphoner-no-webrtc.min.js +2 -2
  15. package/flashphoner-no-wsplayer.js +48 -23
  16. package/flashphoner-no-wsplayer.min.js +2 -2
  17. package/flashphoner-room-api.js +60 -19
  18. package/flashphoner-room-api.min.js +3 -3
  19. package/flashphoner-temasys-flash-websocket-without-adapterjs.js +3 -10
  20. package/flashphoner-temasys-flash-websocket.js +3 -10
  21. package/flashphoner-temasys-flash-websocket.min.js +1 -1
  22. package/flashphoner-webrtc-only.js +46 -21
  23. package/flashphoner-webrtc-only.min.js +1 -1
  24. package/flashphoner.js +48 -23
  25. package/flashphoner.min.js +2 -2
  26. package/package.json +1 -1
  27. package/src/media-source-media-provider.js +2 -2
  28. package/src/webrtc-media-provider.js +58 -17
  29. /package/examples/demo/streaming/hls-player/{video-js.css → videojs7/video-js.css} +0 -0
@@ -417,6 +417,7 @@ var createConnection = function (options) {
417
417
  }
418
418
  return true;
419
419
  };
420
+
420
421
  var muteVideo = function () {
421
422
  if (localVideo && localVideo.srcObject && localVideo.srcObject.getVideoTracks().length > 0) {
422
423
  localVideo.srcObject.getVideoTracks()[0].enabled = false;
@@ -427,15 +428,17 @@ var createConnection = function (options) {
427
428
  localVideo.srcObject.getVideoTracks()[0].enabled = true;
428
429
  }
429
430
  };
431
+
430
432
  var isVideoMuted = function () {
431
433
  if (localVideo && localVideo.srcObject && localVideo.srcObject.getVideoTracks().length > 0) {
432
434
  return !localVideo.srcObject.getVideoTracks()[0].enabled;
433
435
  }
434
436
  return true;
435
437
  };
438
+
436
439
  var getStat = function (callbackFn, nativeStats) {
437
- var browser = browserDetails.browser;
438
- var result = {outboundStream: {}, inboundStream: {}, otherStats: []};
440
+ let browser = browserDetails.browser;
441
+ let result = {outboundStream: {}, inboundStream: {}, otherStats: []};
439
442
  if (connection && validBrowsers.includes(browser)) {
440
443
  if (nativeStats) {
441
444
  return connection.getStats(null);
@@ -444,18 +447,18 @@ var createConnection = function (options) {
444
447
  if (stat) {
445
448
  stat.forEach(function (report) {
446
449
  if (!report.isRemote) {
450
+ let mediaType = "";
447
451
  if (report.type == 'outbound-rtp') {
448
- fillStatObject(result.outboundStream, report);
449
- if (report.mediaType == 'video' && localVideo != undefined && localVideo != null) {
450
- var vSettings = localVideo.srcObject.getVideoTracks()[0].getSettings();
451
- result.outboundStream[report.mediaType].height = vSettings.height;
452
- result.outboundStream[report.mediaType].width = vSettings.width;
452
+ mediaType = getReportMediaType(report);
453
+ fillStatObject(result.outboundStream, report, mediaType);
454
+ if (mediaType == 'video') {
455
+ getVideoSize(result.outboundStream[mediaType], report);
453
456
  }
454
457
  } else if (report.type == 'inbound-rtp') {
455
- fillStatObject(result.inboundStream, report);
456
- if (report.mediaType == 'video' && remoteVideo != undefined && remoteVideo != null) {
457
- result.inboundStream[report.mediaType].height = remoteVideo.videoHeight;
458
- result.inboundStream[report.mediaType].width = remoteVideo.videoWidth;
458
+ mediaType = getReportMediaType(report);
459
+ fillStatObject(result.inboundStream, report, mediaType);
460
+ if (mediaType == 'video') {
461
+ getVideoSize(result.inboundStream[mediaType], report);
459
462
  }
460
463
  }
461
464
  }
@@ -468,13 +471,47 @@ var createConnection = function (options) {
468
471
  }
469
472
  };
470
473
 
471
- function fillStatObject(obj, report) {
472
- var mediaType = report.mediaType;
474
+ var getReportMediaType = function (report) {
475
+ // Since Safari 17 report.mediaType is undefined #WCS-3922
476
+ if (report.mediaType !== undefined) {
477
+ return report.mediaType;
478
+ } else if (report.kind !== undefined) {
479
+ return report.kind;
480
+ }
481
+ logger.warn(LOG_PREFIX, "No media type provided in WebRTC statistics");
482
+ return "media";
483
+ };
484
+
485
+ var getVideoSize = function (obj, report) {
486
+ let videoSize = {};
487
+ if (report.type == 'outbound-rtp') {
488
+ if (localVideo !== undefined && localVideo != null) {
489
+ videoSize = localVideo.srcObject.getVideoTracks()[0].getSettings();
490
+ }
491
+ } else if (report.type == 'inbound-rtp') {
492
+ if (remoteVideo !== undefined && remoteVideo != null) {
493
+ videoSize.width = remoteVideo.videoWidth;
494
+ videoSize.height = remoteVideo.videoHeight;
495
+ }
496
+ }
497
+ if (report.frameWidth !== undefined) {
498
+ obj.width = report.frameWidth;
499
+ } else if (videoSize.width !== undefined) {
500
+ obj.width = videoSize.width;
501
+ }
502
+ if (report.frameHeight !== undefined) {
503
+ obj.height = report.frameHeight;
504
+ } else if (videoSize.height !== undefined) {
505
+ obj.height = videoSize.height;
506
+ }
507
+ };
508
+
509
+ var fillStatObject = function (obj, report, mediaType) {
473
510
  obj[mediaType] = {};
474
511
  //WCS-1922, currentRemoteDescription - browser compatibilitySection: Chrome 70, FF 57, Safari 11
475
- var description = connection.currentRemoteDescription != undefined ? connection.currentRemoteDescription : connection.remoteDescription;
512
+ let description = connection.currentRemoteDescription != undefined ? connection.currentRemoteDescription : connection.remoteDescription;
476
513
  // SDP may be null in Safari 12.1 and older, prevent TypeError here #WCS-3583
477
- var sdp = "";
514
+ let sdp = "";
478
515
  if (description && description.sdp) {
479
516
  sdp = description.sdp;
480
517
  } else {
@@ -485,11 +522,15 @@ var createConnection = function (options) {
485
522
  obj[mediaType]["codecRate"] = codec.sampleRate;
486
523
  Object.keys(report).forEach(function (key) {
487
524
  // Add audioLevel parameter parsing #WCS-3290
488
- if (key.startsWith("bytes") || key.startsWith("packets") || key.indexOf("Count") != -1 || key.indexOf("audioLevel") != -1) {
525
+ if (key.startsWith("bytes") ||
526
+ key.startsWith("packets") ||
527
+ key.indexOf("Count") != -1 ||
528
+ key.indexOf("audioLevel") != -1 ||
529
+ key == "framesPerSecond") {
489
530
  obj[mediaType][key] = report[key];
490
531
  }
491
532
  });
492
- }
533
+ };
493
534
 
494
535
  var fullScreen = function () {
495
536
  var video = document.getElementById(id);