@clappr/hlsjs-playback 1.7.3 → 1.8.0

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.
@@ -1,5 +1,82 @@
1
1
  import { Utils, Events as Events$1, Playback, Log, PlayerError, HTML5Video } from '@clappr/core';
2
2
 
3
+ function _arrayLikeToArray(r, a) {
4
+ (null == a || a > r.length) && (a = r.length);
5
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
+ return n;
7
+ }
8
+ function _arrayWithoutHoles(r) {
9
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
10
+ }
11
+ function _assertThisInitialized(e) {
12
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13
+ return e;
14
+ }
15
+ function _callSuper(t, o, e) {
16
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
17
+ }
18
+ function _classCallCheck(a, n) {
19
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
20
+ }
21
+ function _defineProperties(e, r) {
22
+ for (var t = 0; t < r.length; t++) {
23
+ var o = r[t];
24
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
25
+ }
26
+ }
27
+ function _createClass(e, r, t) {
28
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
29
+ writable: !1
30
+ }), e;
31
+ }
32
+ function _defineProperty$1(e, r, t) {
33
+ return (r = _toPropertyKey$1(r)) in e ? Object.defineProperty(e, r, {
34
+ value: t,
35
+ enumerable: !0,
36
+ configurable: !0,
37
+ writable: !0
38
+ }) : e[r] = t, e;
39
+ }
40
+ function _get() {
41
+ return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) {
42
+ var p = _superPropBase(e, t);
43
+ if (p) {
44
+ var n = Object.getOwnPropertyDescriptor(p, t);
45
+ return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value;
46
+ }
47
+ }, _get.apply(null, arguments);
48
+ }
49
+ function _getPrototypeOf(t) {
50
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
51
+ return t.__proto__ || Object.getPrototypeOf(t);
52
+ }, _getPrototypeOf(t);
53
+ }
54
+ function _inherits(t, e) {
55
+ if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
56
+ t.prototype = Object.create(e && e.prototype, {
57
+ constructor: {
58
+ value: t,
59
+ writable: !0,
60
+ configurable: !0
61
+ }
62
+ }), Object.defineProperty(t, "prototype", {
63
+ writable: !1
64
+ }), e && _setPrototypeOf(t, e);
65
+ }
66
+ function _isNativeReflectConstruct() {
67
+ try {
68
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
69
+ } catch (t) {}
70
+ return (_isNativeReflectConstruct = function () {
71
+ return !!t;
72
+ })();
73
+ }
74
+ function _iterableToArray(r) {
75
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
76
+ }
77
+ function _nonIterableSpread() {
78
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
79
+ }
3
80
  function ownKeys$1(e, r) {
4
81
  var t = Object.keys(e);
5
82
  if (Object.getOwnPropertySymbols) {
@@ -21,171 +98,49 @@ function _objectSpread2$1(e) {
21
98
  }
22
99
  return e;
23
100
  }
24
- function _classCallCheck(instance, Constructor) {
25
- if (!(instance instanceof Constructor)) {
26
- throw new TypeError("Cannot call a class as a function");
27
- }
28
- }
29
- function _defineProperties(target, props) {
30
- for (var i = 0; i < props.length; i++) {
31
- var descriptor = props[i];
32
- descriptor.enumerable = descriptor.enumerable || false;
33
- descriptor.configurable = true;
34
- if ("value" in descriptor) descriptor.writable = true;
35
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
36
- }
37
- }
38
- function _createClass(Constructor, protoProps, staticProps) {
39
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
40
- if (staticProps) _defineProperties(Constructor, staticProps);
41
- Object.defineProperty(Constructor, "prototype", {
42
- writable: false
43
- });
44
- return Constructor;
45
- }
46
- function _defineProperty$1(obj, key, value) {
47
- key = _toPropertyKey$1(key);
48
- if (key in obj) {
49
- Object.defineProperty(obj, key, {
50
- value: value,
51
- enumerable: true,
52
- configurable: true,
53
- writable: true
54
- });
55
- } else {
56
- obj[key] = value;
57
- }
58
- return obj;
59
- }
60
- function _inherits(subClass, superClass) {
61
- if (typeof superClass !== "function" && superClass !== null) {
62
- throw new TypeError("Super expression must either be null or a function");
63
- }
64
- subClass.prototype = Object.create(superClass && superClass.prototype, {
65
- constructor: {
66
- value: subClass,
67
- writable: true,
68
- configurable: true
69
- }
70
- });
71
- Object.defineProperty(subClass, "prototype", {
72
- writable: false
73
- });
74
- if (superClass) _setPrototypeOf(subClass, superClass);
75
- }
76
- function _getPrototypeOf(o) {
77
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
78
- return o.__proto__ || Object.getPrototypeOf(o);
79
- };
80
- return _getPrototypeOf(o);
81
- }
82
- function _setPrototypeOf(o, p) {
83
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
84
- o.__proto__ = p;
85
- return o;
86
- };
87
- return _setPrototypeOf(o, p);
88
- }
89
- function _isNativeReflectConstruct() {
90
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
91
- if (Reflect.construct.sham) return false;
92
- if (typeof Proxy === "function") return true;
93
- try {
94
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
95
- return true;
96
- } catch (e) {
97
- return false;
98
- }
101
+ function _possibleConstructorReturn(t, e) {
102
+ if (e && ("object" == typeof e || "function" == typeof e)) return e;
103
+ if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
104
+ return _assertThisInitialized(t);
99
105
  }
100
- function _assertThisInitialized(self) {
101
- if (self === void 0) {
102
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
103
- }
104
- return self;
106
+ function _setPrototypeOf(t, e) {
107
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
108
+ return t.__proto__ = e, t;
109
+ }, _setPrototypeOf(t, e);
105
110
  }
106
- function _possibleConstructorReturn(self, call) {
107
- if (call && (typeof call === "object" || typeof call === "function")) {
108
- return call;
109
- } else if (call !== void 0) {
110
- throw new TypeError("Derived constructors may only return object or undefined");
111
- }
112
- return _assertThisInitialized(self);
111
+ function _superPropBase(t, o) {
112
+ for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t)););
113
+ return t;
113
114
  }
114
- function _createSuper(Derived) {
115
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
116
- return function _createSuperInternal() {
117
- var Super = _getPrototypeOf(Derived),
118
- result;
119
- if (hasNativeReflectConstruct) {
120
- var NewTarget = _getPrototypeOf(this).constructor;
121
- result = Reflect.construct(Super, arguments, NewTarget);
122
- } else {
123
- result = Super.apply(this, arguments);
124
- }
125
- return _possibleConstructorReturn(this, result);
126
- };
115
+ function _superPropGet(t, o, e, r) {
116
+ var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);
117
+ return 2 & r && "function" == typeof p ? function (t) {
118
+ return p.apply(e, t);
119
+ } : p;
127
120
  }
128
- function _superPropBase(object, property) {
129
- while (!Object.prototype.hasOwnProperty.call(object, property)) {
130
- object = _getPrototypeOf(object);
131
- if (object === null) break;
132
- }
133
- return object;
121
+ function _toConsumableArray(r) {
122
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
134
123
  }
135
- function _get() {
136
- if (typeof Reflect !== "undefined" && Reflect.get) {
137
- _get = Reflect.get.bind();
138
- } else {
139
- _get = function _get(target, property, receiver) {
140
- var base = _superPropBase(target, property);
141
- if (!base) return;
142
- var desc = Object.getOwnPropertyDescriptor(base, property);
143
- if (desc.get) {
144
- return desc.get.call(arguments.length < 3 ? target : receiver);
145
- }
146
- return desc.value;
147
- };
124
+ function _toPrimitive$1(t, r) {
125
+ if ("object" != typeof t || !t) return t;
126
+ var e = t[Symbol.toPrimitive];
127
+ if (void 0 !== e) {
128
+ var i = e.call(t, r || "default");
129
+ if ("object" != typeof i) return i;
130
+ throw new TypeError("@@toPrimitive must return a primitive value.");
148
131
  }
149
- return _get.apply(this, arguments);
150
- }
151
- function _toConsumableArray(arr) {
152
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
153
- }
154
- function _arrayWithoutHoles(arr) {
155
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
156
- }
157
- function _iterableToArray(iter) {
158
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
159
- }
160
- function _unsupportedIterableToArray(o, minLen) {
161
- if (!o) return;
162
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
163
- var n = Object.prototype.toString.call(o).slice(8, -1);
164
- if (n === "Object" && o.constructor) n = o.constructor.name;
165
- if (n === "Map" || n === "Set") return Array.from(o);
166
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
167
- }
168
- function _arrayLikeToArray(arr, len) {
169
- if (len == null || len > arr.length) len = arr.length;
170
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
171
- return arr2;
132
+ return ("string" === r ? String : Number)(t);
172
133
  }
173
- function _nonIterableSpread() {
174
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
134
+ function _toPropertyKey$1(t) {
135
+ var i = _toPrimitive$1(t, "string");
136
+ return "symbol" == typeof i ? i : i + "";
175
137
  }
176
- function _toPrimitive$1(input, hint) {
177
- if (typeof input !== "object" || input === null) return input;
178
- var prim = input[Symbol.toPrimitive];
179
- if (prim !== undefined) {
180
- var res = prim.call(input, hint || "default");
181
- if (typeof res !== "object") return res;
182
- throw new TypeError("@@toPrimitive must return a primitive value.");
138
+ function _unsupportedIterableToArray(r, a) {
139
+ if (r) {
140
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
141
+ var t = {}.toString.call(r).slice(8, -1);
142
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
183
143
  }
184
- return (hint === "string" ? String : Number)(input);
185
- }
186
- function _toPropertyKey$1(arg) {
187
- var key = _toPrimitive$1(arg, "string");
188
- return typeof key === "symbol" ? key : String(key);
189
144
  }
190
145
 
191
146
  function getDefaultExportFromCjs (x) {
@@ -28739,15 +28694,13 @@ var DEFAULT_RECOVER_ATTEMPTS = 16;
28739
28694
  Events$1.register('PLAYBACK_FRAGMENT_CHANGED');
28740
28695
  Events$1.register('PLAYBACK_FRAGMENT_PARSING_METADATA');
28741
28696
  var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
28742
- _inherits(HlsjsPlayback, _HTML5Video);
28743
- var _super = _createSuper(HlsjsPlayback);
28744
28697
  function HlsjsPlayback() {
28745
28698
  var _this;
28746
28699
  _classCallCheck(this, HlsjsPlayback);
28747
28700
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28748
28701
  args[_key] = arguments[_key];
28749
28702
  }
28750
- _this = _super.call.apply(_super, [this].concat(args));
28703
+ _this = _callSuper(this, HlsjsPlayback, [].concat(args));
28751
28704
  _this.options.hlsPlayback = _objectSpread2$1(_objectSpread2$1({}, _this.defaultOptions), _this.options.hlsPlayback);
28752
28705
  _this._timeUpdateThrottleDelay = 200;
28753
28706
  _this._timeUpdateFiringRate = 0.2;
@@ -28755,7 +28708,8 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
28755
28708
  _this._setInitialState();
28756
28709
  return _this;
28757
28710
  }
28758
- _createClass(HlsjsPlayback, [{
28711
+ _inherits(HlsjsPlayback, _HTML5Video);
28712
+ return _createClass(HlsjsPlayback, [{
28759
28713
  key: "name",
28760
28714
  get: function get() {
28761
28715
  return 'hls';
@@ -28764,7 +28718,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
28764
28718
  key: "supportedVersion",
28765
28719
  get: function get() {
28766
28720
  return {
28767
- min: "0.11.3"
28721
+ min: "0.11.4"
28768
28722
  };
28769
28723
  }
28770
28724
  }, {
@@ -28792,6 +28746,11 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
28792
28746
  get: function get() {
28793
28747
  return this._hls.latency;
28794
28748
  }
28749
+ }, {
28750
+ key: "liveSyncPosition",
28751
+ get: function get() {
28752
+ return this._hls.liveSyncPosition;
28753
+ }
28795
28754
  }, {
28796
28755
  key: "currentProgramDateTime",
28797
28756
  get: function get() {
@@ -29046,7 +29005,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
29046
29005
  key: "render",
29047
29006
  value: function render() {
29048
29007
  this._ready();
29049
- return _get(_getPrototypeOf(HlsjsPlayback.prototype), "render", this).call(this);
29008
+ return _superPropGet(HlsjsPlayback, "render", this, 3)([]);
29050
29009
  }
29051
29010
  }, {
29052
29011
  key: "_ready",
@@ -29290,7 +29249,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
29290
29249
  var isSameDuration = Math.abs(this._lastDuration - duration) < this._durationChangeMinOffset;
29291
29250
  if (isSameDuration) return;
29292
29251
  this._lastDuration = duration;
29293
- _get(_getPrototypeOf(HlsjsPlayback.prototype), "_onDurationChange", this).call(this);
29252
+ _superPropGet(HlsjsPlayback, "_onDurationChange", this, 3)([]);
29294
29253
  }
29295
29254
  }, {
29296
29255
  key: "_onProgress",
@@ -29325,7 +29284,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
29325
29284
  value: function play() {
29326
29285
  !this._hls && this._setup();
29327
29286
  !this._manifestLoading && !this.options.hlsPlayback.preload && this._hls.loadSource(this.options.src);
29328
- _get(_getPrototypeOf(HlsjsPlayback.prototype), "play", this).call(this);
29287
+ _superPropGet(HlsjsPlayback, "play", this, 3)([]);
29329
29288
  this._startTimeUpdateTimer();
29330
29289
  }
29331
29290
  }, {
@@ -29338,7 +29297,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
29338
29297
  key: "stop",
29339
29298
  value: function stop() {
29340
29299
  this._stopTimeUpdateTimer();
29341
- if (this._hls) _get(_getPrototypeOf(HlsjsPlayback.prototype), "stop", this).call(this);
29300
+ if (this._hls) _superPropGet(HlsjsPlayback, "stop", this, 3)([]);
29342
29301
  this._destroyHLSInstance();
29343
29302
  }
29344
29303
  }, {
@@ -29346,7 +29305,7 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
29346
29305
  value: function destroy() {
29347
29306
  this._stopTimeUpdateTimer();
29348
29307
  this._destroyHLSInstance();
29349
- _get(_getPrototypeOf(HlsjsPlayback.prototype), "destroy", this).call(this);
29308
+ _superPropGet(HlsjsPlayback, "destroy", this, 3)([]);
29350
29309
  }
29351
29310
  }, {
29352
29311
  key: "_updatePlaybackType",
@@ -29558,7 +29517,6 @@ var HlsjsPlayback = /*#__PURE__*/function (_HTML5Video) {
29558
29517
  return Hls;
29559
29518
  }
29560
29519
  }]);
29561
- return HlsjsPlayback;
29562
29520
  }(HTML5Video);
29563
29521
  HlsjsPlayback.canPlay = function (resource, mimeType) {
29564
29522
  var resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || [];