@webex/internal-media-core 1.38.4 → 1.38.5

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/dist/esm/index.js CHANGED
@@ -7377,6 +7377,364 @@ function mungeRemoteSdp(config, sdp) {
7377
7377
  return parsedSdp.toString();
7378
7378
  }
7379
7379
 
7380
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global$1 !== 'undefined' ? global$1 : typeof self !== 'undefined' ? self : {};
7381
+ var logger = {
7382
+ exports: {}
7383
+ };
7384
+
7385
+ /*!
7386
+ * js-logger - http://github.com/jonnyreeves/js-logger
7387
+ * Jonny Reeves, http://jonnyreeves.co.uk/
7388
+ * js-logger may be freely distributed under the MIT license.
7389
+ */
7390
+
7391
+ (function (module) {
7392
+ (function (global) {
7393
+ // Top level module for the global, static logger instance.
7394
+ var Logger = {};
7395
+
7396
+ // For those that are at home that are keeping score.
7397
+ Logger.VERSION = "1.6.1";
7398
+
7399
+ // Function which handles all incoming log messages.
7400
+ var logHandler;
7401
+
7402
+ // Map of ContextualLogger instances by name; used by Logger.get() to return the same named instance.
7403
+ var contextualLoggersByNameMap = {};
7404
+
7405
+ // Polyfill for ES5's Function.bind.
7406
+ var bind = function bind(scope, func) {
7407
+ return function () {
7408
+ return func.apply(scope, arguments);
7409
+ };
7410
+ };
7411
+
7412
+ // Super exciting object merger-matron 9000 adding another 100 bytes to your download.
7413
+ var merge = function merge() {
7414
+ var args = arguments,
7415
+ target = args[0],
7416
+ key,
7417
+ i;
7418
+ for (i = 1; i < args.length; i++) {
7419
+ for (key in args[i]) {
7420
+ if (!(key in target) && args[i].hasOwnProperty(key)) {
7421
+ target[key] = args[i][key];
7422
+ }
7423
+ }
7424
+ }
7425
+ return target;
7426
+ };
7427
+
7428
+ // Helper to define a logging level object; helps with optimisation.
7429
+ var defineLogLevel = function defineLogLevel(value, name) {
7430
+ return {
7431
+ value: value,
7432
+ name: name
7433
+ };
7434
+ };
7435
+
7436
+ // Predefined logging levels.
7437
+ Logger.TRACE = defineLogLevel(1, 'TRACE');
7438
+ Logger.DEBUG = defineLogLevel(2, 'DEBUG');
7439
+ Logger.INFO = defineLogLevel(3, 'INFO');
7440
+ Logger.TIME = defineLogLevel(4, 'TIME');
7441
+ Logger.WARN = defineLogLevel(5, 'WARN');
7442
+ Logger.ERROR = defineLogLevel(8, 'ERROR');
7443
+ Logger.OFF = defineLogLevel(99, 'OFF');
7444
+
7445
+ // Inner class which performs the bulk of the work; ContextualLogger instances can be configured independently
7446
+ // of each other.
7447
+ var ContextualLogger = function ContextualLogger(defaultContext) {
7448
+ this.context = defaultContext;
7449
+ this.setLevel(defaultContext.filterLevel);
7450
+ this.log = this.info; // Convenience alias.
7451
+ };
7452
+
7453
+ ContextualLogger.prototype = {
7454
+ // Changes the current logging level for the logging instance.
7455
+ setLevel: function setLevel(newLevel) {
7456
+ // Ensure the supplied Level object looks valid.
7457
+ if (newLevel && "value" in newLevel) {
7458
+ this.context.filterLevel = newLevel;
7459
+ }
7460
+ },
7461
+ // Gets the current logging level for the logging instance
7462
+ getLevel: function getLevel() {
7463
+ return this.context.filterLevel;
7464
+ },
7465
+ // Is the logger configured to output messages at the supplied level?
7466
+ enabledFor: function enabledFor(lvl) {
7467
+ var filterLevel = this.context.filterLevel;
7468
+ return lvl.value >= filterLevel.value;
7469
+ },
7470
+ trace: function trace() {
7471
+ this.invoke(Logger.TRACE, arguments);
7472
+ },
7473
+ debug: function debug() {
7474
+ this.invoke(Logger.DEBUG, arguments);
7475
+ },
7476
+ info: function info() {
7477
+ this.invoke(Logger.INFO, arguments);
7478
+ },
7479
+ warn: function warn() {
7480
+ this.invoke(Logger.WARN, arguments);
7481
+ },
7482
+ error: function error() {
7483
+ this.invoke(Logger.ERROR, arguments);
7484
+ },
7485
+ time: function time(label) {
7486
+ if (typeof label === 'string' && label.length > 0) {
7487
+ this.invoke(Logger.TIME, [label, 'start']);
7488
+ }
7489
+ },
7490
+ timeEnd: function timeEnd(label) {
7491
+ if (typeof label === 'string' && label.length > 0) {
7492
+ this.invoke(Logger.TIME, [label, 'end']);
7493
+ }
7494
+ },
7495
+ // Invokes the logger callback if it's not being filtered.
7496
+ invoke: function invoke(level, msgArgs) {
7497
+ if (logHandler && this.enabledFor(level)) {
7498
+ logHandler(msgArgs, merge({
7499
+ level: level
7500
+ }, this.context));
7501
+ }
7502
+ }
7503
+ };
7504
+
7505
+ // Protected instance which all calls to the to level `Logger` module will be routed through.
7506
+ var globalLogger = new ContextualLogger({
7507
+ filterLevel: Logger.OFF
7508
+ });
7509
+
7510
+ // Configure the global Logger instance.
7511
+ (function () {
7512
+ // Shortcut for optimisers.
7513
+ var L = Logger;
7514
+ L.enabledFor = bind(globalLogger, globalLogger.enabledFor);
7515
+ L.trace = bind(globalLogger, globalLogger.trace);
7516
+ L.debug = bind(globalLogger, globalLogger.debug);
7517
+ L.time = bind(globalLogger, globalLogger.time);
7518
+ L.timeEnd = bind(globalLogger, globalLogger.timeEnd);
7519
+ L.info = bind(globalLogger, globalLogger.info);
7520
+ L.warn = bind(globalLogger, globalLogger.warn);
7521
+ L.error = bind(globalLogger, globalLogger.error);
7522
+
7523
+ // Don't forget the convenience alias!
7524
+ L.log = L.info;
7525
+ })();
7526
+
7527
+ // Set the global logging handler. The supplied function should expect two arguments, the first being an arguments
7528
+ // object with the supplied log messages and the second being a context object which contains a hash of stateful
7529
+ // parameters which the logging function can consume.
7530
+ Logger.setHandler = function (func) {
7531
+ logHandler = func;
7532
+ };
7533
+
7534
+ // Sets the global logging filter level which applies to *all* previously registered, and future Logger instances.
7535
+ // (note that named loggers (retrieved via `Logger.get`) can be configured independently if required).
7536
+ Logger.setLevel = function (level) {
7537
+ // Set the globalLogger's level.
7538
+ globalLogger.setLevel(level);
7539
+
7540
+ // Apply this level to all registered contextual loggers.
7541
+ for (var key in contextualLoggersByNameMap) {
7542
+ if (contextualLoggersByNameMap.hasOwnProperty(key)) {
7543
+ contextualLoggersByNameMap[key].setLevel(level);
7544
+ }
7545
+ }
7546
+ };
7547
+
7548
+ // Gets the global logging filter level
7549
+ Logger.getLevel = function () {
7550
+ return globalLogger.getLevel();
7551
+ };
7552
+
7553
+ // Retrieve a ContextualLogger instance. Note that named loggers automatically inherit the global logger's level,
7554
+ // default context and log handler.
7555
+ Logger.get = function (name) {
7556
+ // All logger instances are cached so they can be configured ahead of use.
7557
+ return contextualLoggersByNameMap[name] || (contextualLoggersByNameMap[name] = new ContextualLogger(merge({
7558
+ name: name
7559
+ }, globalLogger.context)));
7560
+ };
7561
+
7562
+ // CreateDefaultHandler returns a handler function which can be passed to `Logger.setHandler()` which will
7563
+ // write to the window's console object (if present); the optional options object can be used to customise the
7564
+ // formatter used to format each log message.
7565
+ Logger.createDefaultHandler = function (options) {
7566
+ options = options || {};
7567
+ options.formatter = options.formatter || function defaultMessageFormatter(messages, context) {
7568
+ // Prepend the logger's name to the log message for easy identification.
7569
+ if (context.name) {
7570
+ messages.unshift("[" + context.name + "]");
7571
+ }
7572
+ };
7573
+
7574
+ // Map of timestamps by timer labels used to track `#time` and `#timeEnd()` invocations in environments
7575
+ // that don't offer a native console method.
7576
+ var timerStartTimeByLabelMap = {};
7577
+
7578
+ // Support for IE8+ (and other, slightly more sane environments)
7579
+ var invokeConsoleMethod = function invokeConsoleMethod(hdlr, messages) {
7580
+ Function.prototype.apply.call(hdlr, console, messages);
7581
+ };
7582
+
7583
+ // Check for the presence of a logger.
7584
+ if (typeof console === "undefined") {
7585
+ return function () {/* no console */};
7586
+ }
7587
+ return function (messages, context) {
7588
+ // Convert arguments object to Array.
7589
+ messages = Array.prototype.slice.call(messages);
7590
+ var hdlr = console.log;
7591
+ var timerLabel;
7592
+ if (context.level === Logger.TIME) {
7593
+ timerLabel = (context.name ? '[' + context.name + '] ' : '') + messages[0];
7594
+ if (messages[1] === 'start') {
7595
+ if (console.time) {
7596
+ console.time(timerLabel);
7597
+ } else {
7598
+ timerStartTimeByLabelMap[timerLabel] = new Date().getTime();
7599
+ }
7600
+ } else {
7601
+ if (console.timeEnd) {
7602
+ console.timeEnd(timerLabel);
7603
+ } else {
7604
+ invokeConsoleMethod(hdlr, [timerLabel + ': ' + (new Date().getTime() - timerStartTimeByLabelMap[timerLabel]) + 'ms']);
7605
+ }
7606
+ }
7607
+ } else {
7608
+ // Delegate through to custom warn/error loggers if present on the console.
7609
+ if (context.level === Logger.WARN && console.warn) {
7610
+ hdlr = console.warn;
7611
+ } else if (context.level === Logger.ERROR && console.error) {
7612
+ hdlr = console.error;
7613
+ } else if (context.level === Logger.INFO && console.info) {
7614
+ hdlr = console.info;
7615
+ } else if (context.level === Logger.DEBUG && console.debug) {
7616
+ hdlr = console.debug;
7617
+ } else if (context.level === Logger.TRACE && console.trace) {
7618
+ hdlr = console.trace;
7619
+ }
7620
+ options.formatter(messages, context);
7621
+ invokeConsoleMethod(hdlr, messages);
7622
+ }
7623
+ };
7624
+ };
7625
+
7626
+ // Configure and example a Default implementation which writes to the `window.console` (if present). The
7627
+ // `options` hash can be used to configure the default logLevel and provide a custom message formatter.
7628
+ Logger.useDefaults = function (options) {
7629
+ Logger.setLevel(options && options.defaultLevel || Logger.DEBUG);
7630
+ Logger.setHandler(Logger.createDefaultHandler(options));
7631
+ };
7632
+
7633
+ // Createa an alias to useDefaults to avoid reaking a react-hooks rule.
7634
+ Logger.setDefaults = Logger.useDefaults;
7635
+
7636
+ // Export to popular environments boilerplate.
7637
+ if (module.exports) {
7638
+ module.exports = Logger;
7639
+ } else {
7640
+ Logger._prevLogger = global.Logger;
7641
+ Logger.noConflict = function () {
7642
+ global.Logger = Logger._prevLogger;
7643
+ return Logger;
7644
+ };
7645
+ global.Logger = Logger;
7646
+ }
7647
+ })(commonjsGlobal);
7648
+ })(logger);
7649
+ var Logger = logger.exports;
7650
+ Logger.useDefaults({
7651
+ defaultLevel: Logger.DEBUG,
7652
+ formatter: (messages, context) => {
7653
+ messages.unshift("[".concat(context.name, "] "));
7654
+ }
7655
+ });
7656
+ class ActiveSpeakerInfo {
7657
+ constructor(priority, crossPriorityDuplication, crossPolicyDuplication, preferLiveVideo, namedMediaGroups) {
7658
+ this.priority = priority;
7659
+ this.crossPriorityDuplication = crossPriorityDuplication;
7660
+ this.crossPolicyDuplication = crossPolicyDuplication;
7661
+ this.preferLiveVideo = preferLiveVideo;
7662
+ this.namedMediaGroups = namedMediaGroups;
7663
+ }
7664
+ toString() {
7665
+ return "ActiveSpeakerInfo(priority=".concat(this.priority, ", crossPriorityDuplication=").concat(this.crossPriorityDuplication, ", crossPolicyDuplication=").concat(this.crossPolicyDuplication, ", preferLiveVideo=").concat(this.preferLiveVideo, "), namedMediaGroups=").concat(this.namedMediaGroups);
7666
+ }
7667
+ }
7668
+ var HomerMsgType;
7669
+ (function (HomerMsgType) {
7670
+ HomerMsgType["Multistream"] = "multistream";
7671
+ })(HomerMsgType || (HomerMsgType = {}));
7672
+ var JmpMsgType;
7673
+ (function (JmpMsgType) {
7674
+ JmpMsgType["MediaRequest"] = "mediaRequest";
7675
+ JmpMsgType["MediaRequestAck"] = "mediaRequestAck";
7676
+ JmpMsgType["MediaRequestStatus"] = "mediaRequestStatus";
7677
+ JmpMsgType["MediaRequestStatusAck"] = "mediaRequestStatusAck";
7678
+ JmpMsgType["SourceAdvertisement"] = "sourceAdvertisement";
7679
+ JmpMsgType["SourceAdvertisementAck"] = "sourceAdvertisementAck";
7680
+ JmpMsgType["ActiveSpeakerNotification"] = "activeSpeakerNotification";
7681
+ })(JmpMsgType || (JmpMsgType = {}));
7682
+ class CodecInfo {
7683
+ constructor(payloadType, h264) {
7684
+ this.payloadType = payloadType;
7685
+ this.h264 = h264;
7686
+ }
7687
+ }
7688
+ class H264Codec {
7689
+ constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
7690
+ this.maxFs = maxFs;
7691
+ this.maxFps = maxFps;
7692
+ this.maxMbps = maxMbps;
7693
+ this.maxWidth = maxWidth;
7694
+ this.maxHeight = maxHeight;
7695
+ }
7696
+ }
7697
+ class ReceiverSelectedInfo {
7698
+ constructor(csi) {
7699
+ this.csi = csi;
7700
+ }
7701
+ toString() {
7702
+ return "ReceiverSelectedInfo(csi=".concat(this.csi, ")");
7703
+ }
7704
+ }
7705
+ var MediaFamily;
7706
+ (function (MediaFamily) {
7707
+ MediaFamily["Audio"] = "AUDIO";
7708
+ MediaFamily["Video"] = "VIDEO";
7709
+ })(MediaFamily || (MediaFamily = {}));
7710
+ var MediaContent;
7711
+ (function (MediaContent) {
7712
+ MediaContent["Main"] = "MAIN";
7713
+ MediaContent["Slides"] = "SLIDES";
7714
+ })(MediaContent || (MediaContent = {}));
7715
+ var Policy;
7716
+ (function (Policy) {
7717
+ Policy["ActiveSpeaker"] = "active-speaker";
7718
+ Policy["ReceiverSelected"] = "receiver-selected";
7719
+ })(Policy || (Policy = {}));
7720
+ var MediaType;
7721
+ (function (MediaType) {
7722
+ MediaType["VideoMain"] = "VIDEO-MAIN";
7723
+ MediaType["VideoSlides"] = "VIDEO-SLIDES";
7724
+ MediaType["AudioMain"] = "AUDIO-MAIN";
7725
+ MediaType["AudioSlides"] = "AUDIO-SLIDES";
7726
+ })(MediaType || (MediaType = {}));
7727
+ function getMediaFamily(mediaType) {
7728
+ return [MediaType.VideoMain, MediaType.VideoSlides].includes(mediaType) ? MediaFamily.Video : MediaFamily.Audio;
7729
+ }
7730
+ var JmpSessionEvents;
7731
+ (function (JmpSessionEvents) {
7732
+ JmpSessionEvents["ActiveSpeaker"] = "active-speaker";
7733
+ JmpSessionEvents["MediaRequestReceived"] = "media-request-received";
7734
+ JmpSessionEvents["MediaRequestStatusReceived"] = "media-request-status-received";
7735
+ JmpSessionEvents["SourceAdvertisementReceived"] = "source-advertisement-received";
7736
+ })(JmpSessionEvents || (JmpSessionEvents = {}));
7737
+
7380
7738
  var Event$1;
7381
7739
  (function (Event) {
7382
7740
  Event["CONNECTION_STATE_CHANGED"] = "connectionState:changed";
@@ -15887,450 +16245,92 @@ class RoapMediaConnection extends EventEmitter$3 {
15887
16245
  this.mediaConnection = this.createMediaConnection(config, options, this.debugId);
15888
16246
  this.roap = this.createRoap(this.debugId, seq);
15889
16247
  if (initiateOffer) {
15890
- return this.initiateOffer();
15891
- }
15892
- return Promise.resolve();
15893
- }
15894
- updateLocalTracks(tracks) {
15895
- this.log('updateLocalTracks()', "called with ".concat(JSON.stringify(tracks)));
15896
- var newOfferNeeded = this.mediaConnection.updateLocalTracks(tracks);
15897
- if (newOfferNeeded) {
15898
- this.log('updateLocalTracks()', 'triggering offer...');
15899
- return this.roap.initiateOffer();
15900
- }
15901
- return Promise.resolve();
15902
- }
15903
- updateDirection(direction) {
15904
- this.log('updateDirection()', "called with ".concat(JSON.stringify(direction)));
15905
- var newOfferNeeded = this.mediaConnection.updateDirection(direction);
15906
- if (newOfferNeeded) {
15907
- this.log('updateDirection()', 'triggering offer...');
15908
- return this.roap.initiateOffer();
15909
- }
15910
- return Promise.resolve();
15911
- }
15912
- updateRemoteQualityLevel(newValue) {
15913
- this.log('updateRemoteQualityLevel()', "called with ".concat(newValue));
15914
- var newOfferNeeded = this.mediaConnection.updateRemoteQualityLevel(newValue);
15915
- if (newOfferNeeded) {
15916
- this.log('updateRemoteQualityLevel()', 'triggering offer...');
15917
- return this.roap.initiateOffer();
15918
- }
15919
- return Promise.resolve();
15920
- }
15921
- update(options) {
15922
- this.log('update()', "called with ".concat(JSON.stringify(options)));
15923
- var newOfferNeeded = this.mediaConnection.update(options);
15924
- if (newOfferNeeded) {
15925
- this.log('update()', 'triggering offer...');
15926
- return this.roap.initiateOffer();
15927
- }
15928
- return Promise.resolve();
15929
- }
15930
- getConnectionState() {
15931
- return this.mediaConnection.getConnectionState();
15932
- }
15933
- getStats() {
15934
- return this.mediaConnection.getStats();
15935
- }
15936
- getTransceiverStats() {
15937
- return this.mediaConnection.getTransceiverStats();
15938
- }
15939
- insertDTMF(tones, duration, interToneGap) {
15940
- this.log('insertDTMF()', "called with tones=\"".concat(tones, "\", duration=").concat(duration, ", interToneGap=").concat(interToneGap));
15941
- this.mediaConnection.insertDTMF(tones, duration, interToneGap);
15942
- }
15943
- roapMessageReceived(roapMessage) {
15944
- this.log('roapMessageReceived()', "called with messageType=".concat(roapMessage.messageType, ", seq=").concat(roapMessage.seq));
15945
- if (!this.sdpNegotiationStarted) {
15946
- if (roapMessage.messageType === 'OFFER') {
15947
- this.sdpNegotiationStarted = true;
15948
- this.mediaConnection.initializeTransceivers(true);
15949
- }
15950
- if (roapMessage.messageType === 'OFFER_REQUEST') {
15951
- this.sdpNegotiationStarted = true;
15952
- this.mediaConnection.initializeTransceivers(false);
15953
- }
15954
- }
15955
- this.roap.roapMessageReceived(roapMessage);
15956
- }
15957
- onRemoteTrack(event) {
15958
- this.emit(Event$1.REMOTE_TRACK_ADDED, event);
15959
- }
15960
- onConnectionStateChanged(event) {
15961
- this.emit(Event$1.CONNECTION_STATE_CHANGED, event);
15962
- }
15963
- onDtmfToneChanged(event) {
15964
- this.emit(Event$1.DTMF_TONE_CHANGED, event);
15965
- }
15966
- createLocalOffer() {
15967
- return this.mediaConnection.createLocalOffer();
15968
- }
15969
- handleRemoteOffer(sdp) {
15970
- return this.mediaConnection.handleRemoteOffer(sdp);
15971
- }
15972
- handleRemoteAnswer(sdp) {
15973
- return this.mediaConnection.handleRemoteAnswer(sdp);
15974
- }
15975
- }
15976
-
15977
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global$1 !== 'undefined' ? global$1 : typeof self !== 'undefined' ? self : {};
15978
- var logger = {
15979
- exports: {}
15980
- };
15981
-
15982
- /*!
15983
- * js-logger - http://github.com/jonnyreeves/js-logger
15984
- * Jonny Reeves, http://jonnyreeves.co.uk/
15985
- * js-logger may be freely distributed under the MIT license.
15986
- */
15987
-
15988
- (function (module) {
15989
- (function (global) {
15990
- // Top level module for the global, static logger instance.
15991
- var Logger = {};
15992
-
15993
- // For those that are at home that are keeping score.
15994
- Logger.VERSION = "1.6.1";
15995
-
15996
- // Function which handles all incoming log messages.
15997
- var logHandler;
15998
-
15999
- // Map of ContextualLogger instances by name; used by Logger.get() to return the same named instance.
16000
- var contextualLoggersByNameMap = {};
16001
-
16002
- // Polyfill for ES5's Function.bind.
16003
- var bind = function bind(scope, func) {
16004
- return function () {
16005
- return func.apply(scope, arguments);
16006
- };
16007
- };
16008
-
16009
- // Super exciting object merger-matron 9000 adding another 100 bytes to your download.
16010
- var merge = function merge() {
16011
- var args = arguments,
16012
- target = args[0],
16013
- key,
16014
- i;
16015
- for (i = 1; i < args.length; i++) {
16016
- for (key in args[i]) {
16017
- if (!(key in target) && args[i].hasOwnProperty(key)) {
16018
- target[key] = args[i][key];
16019
- }
16020
- }
16021
- }
16022
- return target;
16023
- };
16024
-
16025
- // Helper to define a logging level object; helps with optimisation.
16026
- var defineLogLevel = function defineLogLevel(value, name) {
16027
- return {
16028
- value: value,
16029
- name: name
16030
- };
16031
- };
16032
-
16033
- // Predefined logging levels.
16034
- Logger.TRACE = defineLogLevel(1, 'TRACE');
16035
- Logger.DEBUG = defineLogLevel(2, 'DEBUG');
16036
- Logger.INFO = defineLogLevel(3, 'INFO');
16037
- Logger.TIME = defineLogLevel(4, 'TIME');
16038
- Logger.WARN = defineLogLevel(5, 'WARN');
16039
- Logger.ERROR = defineLogLevel(8, 'ERROR');
16040
- Logger.OFF = defineLogLevel(99, 'OFF');
16041
-
16042
- // Inner class which performs the bulk of the work; ContextualLogger instances can be configured independently
16043
- // of each other.
16044
- var ContextualLogger = function ContextualLogger(defaultContext) {
16045
- this.context = defaultContext;
16046
- this.setLevel(defaultContext.filterLevel);
16047
- this.log = this.info; // Convenience alias.
16048
- };
16049
-
16050
- ContextualLogger.prototype = {
16051
- // Changes the current logging level for the logging instance.
16052
- setLevel: function setLevel(newLevel) {
16053
- // Ensure the supplied Level object looks valid.
16054
- if (newLevel && "value" in newLevel) {
16055
- this.context.filterLevel = newLevel;
16056
- }
16057
- },
16058
- // Gets the current logging level for the logging instance
16059
- getLevel: function getLevel() {
16060
- return this.context.filterLevel;
16061
- },
16062
- // Is the logger configured to output messages at the supplied level?
16063
- enabledFor: function enabledFor(lvl) {
16064
- var filterLevel = this.context.filterLevel;
16065
- return lvl.value >= filterLevel.value;
16066
- },
16067
- trace: function trace() {
16068
- this.invoke(Logger.TRACE, arguments);
16069
- },
16070
- debug: function debug() {
16071
- this.invoke(Logger.DEBUG, arguments);
16072
- },
16073
- info: function info() {
16074
- this.invoke(Logger.INFO, arguments);
16075
- },
16076
- warn: function warn() {
16077
- this.invoke(Logger.WARN, arguments);
16078
- },
16079
- error: function error() {
16080
- this.invoke(Logger.ERROR, arguments);
16081
- },
16082
- time: function time(label) {
16083
- if (typeof label === 'string' && label.length > 0) {
16084
- this.invoke(Logger.TIME, [label, 'start']);
16085
- }
16086
- },
16087
- timeEnd: function timeEnd(label) {
16088
- if (typeof label === 'string' && label.length > 0) {
16089
- this.invoke(Logger.TIME, [label, 'end']);
16090
- }
16091
- },
16092
- // Invokes the logger callback if it's not being filtered.
16093
- invoke: function invoke(level, msgArgs) {
16094
- if (logHandler && this.enabledFor(level)) {
16095
- logHandler(msgArgs, merge({
16096
- level: level
16097
- }, this.context));
16098
- }
16099
- }
16100
- };
16101
-
16102
- // Protected instance which all calls to the to level `Logger` module will be routed through.
16103
- var globalLogger = new ContextualLogger({
16104
- filterLevel: Logger.OFF
16105
- });
16106
-
16107
- // Configure the global Logger instance.
16108
- (function () {
16109
- // Shortcut for optimisers.
16110
- var L = Logger;
16111
- L.enabledFor = bind(globalLogger, globalLogger.enabledFor);
16112
- L.trace = bind(globalLogger, globalLogger.trace);
16113
- L.debug = bind(globalLogger, globalLogger.debug);
16114
- L.time = bind(globalLogger, globalLogger.time);
16115
- L.timeEnd = bind(globalLogger, globalLogger.timeEnd);
16116
- L.info = bind(globalLogger, globalLogger.info);
16117
- L.warn = bind(globalLogger, globalLogger.warn);
16118
- L.error = bind(globalLogger, globalLogger.error);
16119
-
16120
- // Don't forget the convenience alias!
16121
- L.log = L.info;
16122
- })();
16123
-
16124
- // Set the global logging handler. The supplied function should expect two arguments, the first being an arguments
16125
- // object with the supplied log messages and the second being a context object which contains a hash of stateful
16126
- // parameters which the logging function can consume.
16127
- Logger.setHandler = function (func) {
16128
- logHandler = func;
16129
- };
16130
-
16131
- // Sets the global logging filter level which applies to *all* previously registered, and future Logger instances.
16132
- // (note that named loggers (retrieved via `Logger.get`) can be configured independently if required).
16133
- Logger.setLevel = function (level) {
16134
- // Set the globalLogger's level.
16135
- globalLogger.setLevel(level);
16136
-
16137
- // Apply this level to all registered contextual loggers.
16138
- for (var key in contextualLoggersByNameMap) {
16139
- if (contextualLoggersByNameMap.hasOwnProperty(key)) {
16140
- contextualLoggersByNameMap[key].setLevel(level);
16141
- }
16248
+ return this.initiateOffer();
16249
+ }
16250
+ return Promise.resolve();
16251
+ }
16252
+ updateLocalTracks(tracks) {
16253
+ this.log('updateLocalTracks()', "called with ".concat(JSON.stringify(tracks)));
16254
+ var newOfferNeeded = this.mediaConnection.updateLocalTracks(tracks);
16255
+ if (newOfferNeeded) {
16256
+ this.log('updateLocalTracks()', 'triggering offer...');
16257
+ return this.roap.initiateOffer();
16258
+ }
16259
+ return Promise.resolve();
16260
+ }
16261
+ updateDirection(direction) {
16262
+ this.log('updateDirection()', "called with ".concat(JSON.stringify(direction)));
16263
+ var newOfferNeeded = this.mediaConnection.updateDirection(direction);
16264
+ if (newOfferNeeded) {
16265
+ this.log('updateDirection()', 'triggering offer...');
16266
+ return this.roap.initiateOffer();
16267
+ }
16268
+ return Promise.resolve();
16269
+ }
16270
+ updateRemoteQualityLevel(newValue) {
16271
+ this.log('updateRemoteQualityLevel()', "called with ".concat(newValue));
16272
+ var newOfferNeeded = this.mediaConnection.updateRemoteQualityLevel(newValue);
16273
+ if (newOfferNeeded) {
16274
+ this.log('updateRemoteQualityLevel()', 'triggering offer...');
16275
+ return this.roap.initiateOffer();
16276
+ }
16277
+ return Promise.resolve();
16278
+ }
16279
+ update(options) {
16280
+ this.log('update()', "called with ".concat(JSON.stringify(options)));
16281
+ var newOfferNeeded = this.mediaConnection.update(options);
16282
+ if (newOfferNeeded) {
16283
+ this.log('update()', 'triggering offer...');
16284
+ return this.roap.initiateOffer();
16285
+ }
16286
+ return Promise.resolve();
16287
+ }
16288
+ getConnectionState() {
16289
+ return this.mediaConnection.getConnectionState();
16290
+ }
16291
+ getStats() {
16292
+ return this.mediaConnection.getStats();
16293
+ }
16294
+ getTransceiverStats() {
16295
+ return this.mediaConnection.getTransceiverStats();
16296
+ }
16297
+ insertDTMF(tones, duration, interToneGap) {
16298
+ this.log('insertDTMF()', "called with tones=\"".concat(tones, "\", duration=").concat(duration, ", interToneGap=").concat(interToneGap));
16299
+ this.mediaConnection.insertDTMF(tones, duration, interToneGap);
16300
+ }
16301
+ roapMessageReceived(roapMessage) {
16302
+ this.log('roapMessageReceived()', "called with messageType=".concat(roapMessage.messageType, ", seq=").concat(roapMessage.seq));
16303
+ if (!this.sdpNegotiationStarted) {
16304
+ if (roapMessage.messageType === 'OFFER') {
16305
+ this.sdpNegotiationStarted = true;
16306
+ this.mediaConnection.initializeTransceivers(true);
16142
16307
  }
16143
- };
16144
-
16145
- // Gets the global logging filter level
16146
- Logger.getLevel = function () {
16147
- return globalLogger.getLevel();
16148
- };
16149
-
16150
- // Retrieve a ContextualLogger instance. Note that named loggers automatically inherit the global logger's level,
16151
- // default context and log handler.
16152
- Logger.get = function (name) {
16153
- // All logger instances are cached so they can be configured ahead of use.
16154
- return contextualLoggersByNameMap[name] || (contextualLoggersByNameMap[name] = new ContextualLogger(merge({
16155
- name: name
16156
- }, globalLogger.context)));
16157
- };
16158
-
16159
- // CreateDefaultHandler returns a handler function which can be passed to `Logger.setHandler()` which will
16160
- // write to the window's console object (if present); the optional options object can be used to customise the
16161
- // formatter used to format each log message.
16162
- Logger.createDefaultHandler = function (options) {
16163
- options = options || {};
16164
- options.formatter = options.formatter || function defaultMessageFormatter(messages, context) {
16165
- // Prepend the logger's name to the log message for easy identification.
16166
- if (context.name) {
16167
- messages.unshift("[" + context.name + "]");
16168
- }
16169
- };
16170
-
16171
- // Map of timestamps by timer labels used to track `#time` and `#timeEnd()` invocations in environments
16172
- // that don't offer a native console method.
16173
- var timerStartTimeByLabelMap = {};
16174
-
16175
- // Support for IE8+ (and other, slightly more sane environments)
16176
- var invokeConsoleMethod = function invokeConsoleMethod(hdlr, messages) {
16177
- Function.prototype.apply.call(hdlr, console, messages);
16178
- };
16179
-
16180
- // Check for the presence of a logger.
16181
- if (typeof console === "undefined") {
16182
- return function () {/* no console */};
16308
+ if (roapMessage.messageType === 'OFFER_REQUEST') {
16309
+ this.sdpNegotiationStarted = true;
16310
+ this.mediaConnection.initializeTransceivers(false);
16183
16311
  }
16184
- return function (messages, context) {
16185
- // Convert arguments object to Array.
16186
- messages = Array.prototype.slice.call(messages);
16187
- var hdlr = console.log;
16188
- var timerLabel;
16189
- if (context.level === Logger.TIME) {
16190
- timerLabel = (context.name ? '[' + context.name + '] ' : '') + messages[0];
16191
- if (messages[1] === 'start') {
16192
- if (console.time) {
16193
- console.time(timerLabel);
16194
- } else {
16195
- timerStartTimeByLabelMap[timerLabel] = new Date().getTime();
16196
- }
16197
- } else {
16198
- if (console.timeEnd) {
16199
- console.timeEnd(timerLabel);
16200
- } else {
16201
- invokeConsoleMethod(hdlr, [timerLabel + ': ' + (new Date().getTime() - timerStartTimeByLabelMap[timerLabel]) + 'ms']);
16202
- }
16203
- }
16204
- } else {
16205
- // Delegate through to custom warn/error loggers if present on the console.
16206
- if (context.level === Logger.WARN && console.warn) {
16207
- hdlr = console.warn;
16208
- } else if (context.level === Logger.ERROR && console.error) {
16209
- hdlr = console.error;
16210
- } else if (context.level === Logger.INFO && console.info) {
16211
- hdlr = console.info;
16212
- } else if (context.level === Logger.DEBUG && console.debug) {
16213
- hdlr = console.debug;
16214
- } else if (context.level === Logger.TRACE && console.trace) {
16215
- hdlr = console.trace;
16216
- }
16217
- options.formatter(messages, context);
16218
- invokeConsoleMethod(hdlr, messages);
16219
- }
16220
- };
16221
- };
16222
-
16223
- // Configure and example a Default implementation which writes to the `window.console` (if present). The
16224
- // `options` hash can be used to configure the default logLevel and provide a custom message formatter.
16225
- Logger.useDefaults = function (options) {
16226
- Logger.setLevel(options && options.defaultLevel || Logger.DEBUG);
16227
- Logger.setHandler(Logger.createDefaultHandler(options));
16228
- };
16229
-
16230
- // Createa an alias to useDefaults to avoid reaking a react-hooks rule.
16231
- Logger.setDefaults = Logger.useDefaults;
16232
-
16233
- // Export to popular environments boilerplate.
16234
- if (module.exports) {
16235
- module.exports = Logger;
16236
- } else {
16237
- Logger._prevLogger = global.Logger;
16238
- Logger.noConflict = function () {
16239
- global.Logger = Logger._prevLogger;
16240
- return Logger;
16241
- };
16242
- global.Logger = Logger;
16243
16312
  }
16244
- })(commonjsGlobal);
16245
- })(logger);
16246
- var Logger = logger.exports;
16247
- Logger.useDefaults({
16248
- defaultLevel: Logger.DEBUG,
16249
- formatter: (messages, context) => {
16250
- messages.unshift("[".concat(context.name, "] "));
16313
+ this.roap.roapMessageReceived(roapMessage);
16251
16314
  }
16252
- });
16253
- class ActiveSpeakerInfo {
16254
- constructor(priority, crossPriorityDuplication, crossPolicyDuplication, preferLiveVideo, namedMediaGroups) {
16255
- this.priority = priority;
16256
- this.crossPriorityDuplication = crossPriorityDuplication;
16257
- this.crossPolicyDuplication = crossPolicyDuplication;
16258
- this.preferLiveVideo = preferLiveVideo;
16259
- this.namedMediaGroups = namedMediaGroups;
16315
+ onRemoteTrack(event) {
16316
+ this.emit(Event$1.REMOTE_TRACK_ADDED, event);
16260
16317
  }
16261
- toString() {
16262
- return "ActiveSpeakerInfo(priority=".concat(this.priority, ", crossPriorityDuplication=").concat(this.crossPriorityDuplication, ", crossPolicyDuplication=").concat(this.crossPolicyDuplication, ", preferLiveVideo=").concat(this.preferLiveVideo, "), namedMediaGroups=").concat(this.namedMediaGroups);
16318
+ onConnectionStateChanged(event) {
16319
+ this.emit(Event$1.CONNECTION_STATE_CHANGED, event);
16263
16320
  }
16264
- }
16265
- var HomerMsgType;
16266
- (function (HomerMsgType) {
16267
- HomerMsgType["Multistream"] = "multistream";
16268
- })(HomerMsgType || (HomerMsgType = {}));
16269
- var JmpMsgType;
16270
- (function (JmpMsgType) {
16271
- JmpMsgType["MediaRequest"] = "mediaRequest";
16272
- JmpMsgType["MediaRequestAck"] = "mediaRequestAck";
16273
- JmpMsgType["MediaRequestStatus"] = "mediaRequestStatus";
16274
- JmpMsgType["MediaRequestStatusAck"] = "mediaRequestStatusAck";
16275
- JmpMsgType["SourceAdvertisement"] = "sourceAdvertisement";
16276
- JmpMsgType["SourceAdvertisementAck"] = "sourceAdvertisementAck";
16277
- JmpMsgType["ActiveSpeakerNotification"] = "activeSpeakerNotification";
16278
- })(JmpMsgType || (JmpMsgType = {}));
16279
- class CodecInfo {
16280
- constructor(payloadType, h264) {
16281
- this.payloadType = payloadType;
16282
- this.h264 = h264;
16321
+ onDtmfToneChanged(event) {
16322
+ this.emit(Event$1.DTMF_TONE_CHANGED, event);
16283
16323
  }
16284
- }
16285
- class H264Codec {
16286
- constructor(maxFs, maxFps, maxMbps, maxWidth, maxHeight) {
16287
- this.maxFs = maxFs;
16288
- this.maxFps = maxFps;
16289
- this.maxMbps = maxMbps;
16290
- this.maxWidth = maxWidth;
16291
- this.maxHeight = maxHeight;
16324
+ createLocalOffer() {
16325
+ return this.mediaConnection.createLocalOffer();
16292
16326
  }
16293
- }
16294
- class ReceiverSelectedInfo {
16295
- constructor(csi) {
16296
- this.csi = csi;
16327
+ handleRemoteOffer(sdp) {
16328
+ return this.mediaConnection.handleRemoteOffer(sdp);
16297
16329
  }
16298
- toString() {
16299
- return "ReceiverSelectedInfo(csi=".concat(this.csi, ")");
16330
+ handleRemoteAnswer(sdp) {
16331
+ return this.mediaConnection.handleRemoteAnswer(sdp);
16300
16332
  }
16301
16333
  }
16302
- var MediaFamily;
16303
- (function (MediaFamily) {
16304
- MediaFamily["Audio"] = "AUDIO";
16305
- MediaFamily["Video"] = "VIDEO";
16306
- })(MediaFamily || (MediaFamily = {}));
16307
- var MediaContent;
16308
- (function (MediaContent) {
16309
- MediaContent["Main"] = "MAIN";
16310
- MediaContent["Slides"] = "SLIDES";
16311
- })(MediaContent || (MediaContent = {}));
16312
- var Policy;
16313
- (function (Policy) {
16314
- Policy["ActiveSpeaker"] = "active-speaker";
16315
- Policy["ReceiverSelected"] = "receiver-selected";
16316
- })(Policy || (Policy = {}));
16317
- var MediaType;
16318
- (function (MediaType) {
16319
- MediaType["VideoMain"] = "VIDEO-MAIN";
16320
- MediaType["VideoSlides"] = "VIDEO-SLIDES";
16321
- MediaType["AudioMain"] = "AUDIO-MAIN";
16322
- MediaType["AudioSlides"] = "AUDIO-SLIDES";
16323
- })(MediaType || (MediaType = {}));
16324
- function getMediaFamily(mediaType) {
16325
- return [MediaType.VideoMain, MediaType.VideoSlides].includes(mediaType) ? MediaFamily.Video : MediaFamily.Audio;
16326
- }
16327
- var JmpSessionEvents;
16328
- (function (JmpSessionEvents) {
16329
- JmpSessionEvents["ActiveSpeaker"] = "active-speaker";
16330
- JmpSessionEvents["MediaRequestReceived"] = "media-request-received";
16331
- JmpSessionEvents["MediaRequestStatusReceived"] = "media-request-status-received";
16332
- JmpSessionEvents["SourceAdvertisementReceived"] = "source-advertisement-received";
16333
- })(JmpSessionEvents || (JmpSessionEvents = {}));
16334
16334
 
16335
16335
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16336
16336
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -16534,4 +16534,4 @@ var Media = {
16534
16534
  isBrowserSupported
16535
16535
  };
16536
16536
 
16537
- export { ActiveSpeakerInfo, CodecInfo, ConnectionState, ErrorType, Errors, Event$1 as Event, H264Codec, LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack, LocalTrack, LocalTrackEvents, Media, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamRoapMediaConnection, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteTrackType, RoapMediaConnection, StreamRequest, WcmeError, configureWcmeLogger, createCameraTrack, createDisplayTrack, createMicrophoneTrack, getAudioInputDevices, getAudioOutputDevices, getDevices, getErrorDescription, getLogger, getMediaFamily, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, isBrowserSupported, setLogger, setOnDeviceChangeHandler };
16537
+ export { ActiveSpeakerInfo, CodecInfo, ConnectionState, ErrorType, Errors, Event$1 as Event, H264Codec, LocalCameraTrack, LocalDisplayTrack, LocalMicrophoneTrack, LocalTrack, LocalTrackEvents, Media, MediaContent, MediaFamily, MediaStreamTrackKind, MediaType, MultistreamRoapMediaConnection, PeerConnection, Policy, ReceiveSlot, ReceiveSlotEvents, ReceiverSelectedInfo, RecommendedOpusBitrates, RemoteTrackType, RoapMediaConnection, StreamRequest, WcmeError, configureWcmeLogger, createCameraTrack, createDisplayTrack, createMicrophoneTrack, getAudioInputDevices, getAudioOutputDevices, getDevices, getErrorDescription, getLogger, getMediaFamily, getRecommendedMaxBitrateForFrameSize, getVideoInputDevices, isBrowserSupported, setLogger, setOnDeviceChangeHandler };