@antmedia/web_player 2.11.1 → 2.11.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.
Files changed (41) hide show
  1. package/dist/browser/web_player.js +4 -6
  2. package/dist/es/{plugin-ca799d0d.js → plugin-50e1316e.js} +134 -144
  3. package/dist/es/{video.es-0951ae41.js → video.es-be70c095.js} +36 -41
  4. package/dist/es/{videojs-webrtc-plugin-327afa5e.js → videojs-webrtc-plugin-7054aa21.js} +1 -1
  5. package/dist/es/videojs-webrtc-plugin-f56e1f9e.js +3 -0
  6. package/dist/es/{video.es-22056625.js → videojs-webrtc-plugin.es-2a0dfc29.js} +14968 -5052
  7. package/dist/es/videojs-webrtc-plugin.es-333788d9.js +7673 -0
  8. package/dist/es/{videojs-webrtc-plugin.es-f41400f7.js → videojs-webrtc-plugin.es-777bf41a.js} +1747 -1697
  9. package/dist/es/{videojs-webrtc-plugin.es-bd0b1a6d.js → videojs-webrtc-plugin.es-9544f6e0.js} +1563 -1672
  10. package/dist/es/web_player.js +7 -9
  11. package/dist/index.d.ts +17 -1
  12. package/dist/{plugin-84ab2cdd.js → plugin-bec9dc4a.js} +136 -146
  13. package/dist/{video.es-474303e7.js → video.es-df9af03d.js} +36 -43
  14. package/dist/{videojs-webrtc-plugin-bdf9fa8b.js → videojs-webrtc-plugin-3becde8c.js} +1 -1
  15. package/dist/videojs-webrtc-plugin-77a9860b.js +5 -0
  16. package/dist/{videojs-webrtc-plugin.es-72234e77.js → videojs-webrtc-plugin.es-0787d11e.js} +1575 -1684
  17. package/dist/{video.es-72122d04.js → videojs-webrtc-plugin.es-493b195e.js} +14964 -5052
  18. package/dist/videojs-webrtc-plugin.es-8f4ea4e4.js +7675 -0
  19. package/dist/{videojs-webrtc-plugin.es-ac81d249.js → videojs-webrtc-plugin.es-ee6d0333.js} +1757 -1707
  20. package/dist/web_player.js +7 -9
  21. package/package.json +3 -5
  22. package/rollup.config.module.cjs +6 -2
  23. package/src/web_player.js +4 -6
  24. package/test/embedded-player.test.js +1 -1
  25. package/tsconfig.json +0 -1
  26. package/dist/aframe-master-42bb78a9.js +0 -7139
  27. package/dist/dash.all.min-84806d51.js +0 -36
  28. package/dist/es/aframe-master-a6146619.js +0 -7137
  29. package/dist/es/dash.all.min-4a2772b6.js +0 -34
  30. package/dist/es/inheritsLoose-91dc2acc.js +0 -15
  31. package/dist/es/video-js.min-8b4dfe88.js +0 -3
  32. package/dist/es/videojs-contrib-quality-levels.es-1ea32822.js +0 -276
  33. package/dist/es/videojs-contrib-quality-levels.es-5f5b5f23.js +0 -287
  34. package/dist/es/videojs-hls-quality-selector.es-3c54e1cd.js +0 -391
  35. package/dist/es/videojs-webrtc-plugin-b9e4da27.js +0 -3
  36. package/dist/inheritsLoose-281376c7.js +0 -17
  37. package/dist/video-js.min-7e4ae47a.js +0 -5
  38. package/dist/videojs-contrib-quality-levels.es-6c3be3eb.js +0 -278
  39. package/dist/videojs-contrib-quality-levels.es-ef3cec9e.js +0 -289
  40. package/dist/videojs-hls-quality-selector.es-562309df.js +0 -393
  41. package/dist/videojs-webrtc-plugin-d30c3e7a.js +0 -5
@@ -447,9 +447,7 @@
447
447
  window.videojs = videojs.default;
448
448
  this.videojsLoaded = true;
449
449
  }).then(() => {
450
- return import('videojs-contrib-quality-levels');
451
- }).then(() => {
452
- return import('videojs-hls-quality-selector');
450
+ return import('videojs-quality-selector-hls');
453
451
  }).then(() => {
454
452
  return this.loadWebRTCComponents();
455
453
  });
@@ -512,7 +510,7 @@
512
510
  this.videojsPlayer.pause();
513
511
  setTimeout(() => {
514
512
  this.videojsPlayer.play();
515
- }, 1000);
513
+ }, 2000);
516
514
  }
517
515
  }
518
516
 
@@ -639,8 +637,8 @@
639
637
  };
640
638
  this.videojsPlayer.ready(() => {
641
639
  // If it's already added to player, no need to add again
642
- if (typeof this.videojsPlayer.hlsQualitySelector === "function") {
643
- this.videojsPlayer.hlsQualitySelector({
640
+ if (typeof this.videojsPlayer.qualitySelectorHls === "function") {
641
+ this.videojsPlayer.qualitySelectorHls({
644
642
  displayCurrentQuality: true
645
643
  });
646
644
  }
@@ -1,151 +1,128 @@
1
- import { _ as _inheritsLoose } from './inheritsLoose-91dc2acc.js';
2
- import { v as videojs } from './video.es-0951ae41.js';
1
+ import videojs from './video.es-be70c095.js';
3
2
  import './_commonjsHelpers-7d1333e8.js';
4
3
 
5
- var version = "2.0.0";
4
+ var version = "1.1.1";
6
5
 
7
- var MenuButton = videojs.getComponent('MenuButton');
8
- var Menu = videojs.getComponent('Menu');
9
- var Component = videojs.getComponent('Component');
6
+ var VideoJsButtonClass = videojs.getComponent('MenuButton');
7
+ var VideoJsMenuClass = videojs.getComponent('Menu');
8
+ var VideoJsComponent = videojs.getComponent('Component');
10
9
  var Dom = videojs.dom;
11
-
12
10
  /**
13
11
  * Convert string to title case.
14
12
  *
15
13
  * @param {string} string - the string to convert
16
14
  * @return {string} the returned titlecase string
17
15
  */
16
+
18
17
  function toTitleCase(string) {
19
18
  if (typeof string !== 'string') {
20
19
  return string;
21
20
  }
22
21
  return string.charAt(0).toUpperCase() + string.slice(1);
23
22
  }
24
-
25
23
  /**
26
- * Extend vjs button class for quality button.
24
+ * Convert string to title case.
25
+ *
26
+ * @param {Player} player - the string to convert
27
+ * @return {MenuButton} the returned titlecase string
27
28
  */
28
- var ConcreteButton = /*#__PURE__*/function (_MenuButton) {
29
- _inheritsLoose(ConcreteButton, _MenuButton);
30
- /**
31
- * Button constructor.
32
- *
33
- * @param {Player} player - videojs player instance
34
- */
35
- function ConcreteButton(player) {
36
- return _MenuButton.call(this, player, {
37
- title: player.localize('Quality'),
38
- name: 'QualityButton'
39
- }) || this;
40
- }
41
-
42
- /**
43
- * Creates button items.
44
- *
45
- * @return {Array} - Button items
46
- */
47
- var _proto = ConcreteButton.prototype;
48
- _proto.createItems = function createItems() {
49
- return [];
50
- }
51
-
52
- /**
53
- * Create the menu and add all items to it.
54
- *
55
- * @return {Menu}
56
- * The constructed menu
57
- */;
58
- _proto.createMenu = function createMenu() {
59
- var menu = new Menu(this.player_, {
60
- menuButton: this
61
- });
62
- this.hideThreshold_ = 0;
63
29
 
64
- // Add a title list item to the top
65
- if (this.options_.title) {
66
- var titleEl = Dom.createEl('li', {
67
- className: 'vjs-menu-title',
68
- innerHTML: toTitleCase(this.options_.title),
69
- tabIndex: -1
30
+ function ConcreteButton(player) {
31
+ var _this = this;
32
+ var ConcreteButtonInit = new VideoJsButtonClass(player, {
33
+ title: player.localize('Quality'),
34
+ name: 'QualityButton',
35
+ createItems: function createItems() {
36
+ return [];
37
+ },
38
+ createMenu: function createMenu() {
39
+ var menu = new VideoJsMenuClass(_this.player_, {
40
+ menuButton: _this
70
41
  });
71
- var titleComponent = new Component(this.player_, {
72
- el: titleEl
73
- });
74
- this.hideThreshold_ += 1;
75
- menu.addItem(titleComponent);
76
- }
77
- this.items = this.createItems();
78
- if (this.items) {
79
- // Add menu items to the menu
80
- for (var i = 0; i < this.items.length; i++) {
81
- menu.addItem(this.items[i]);
42
+ _this.hideThreshold_ = 0; // Add a title list item to the top
43
+
44
+ if (_this.options_.title) {
45
+ var titleEl = Dom.createEl('li', {
46
+ className: 'vjs-menu-title',
47
+ innerHTML: toTitleCase(_this.options_.title),
48
+ tabIndex: -1
49
+ });
50
+ var titleComponent = new VideoJsComponent(_this.player_, {
51
+ el: titleEl
52
+ });
53
+ _this.hideThreshold_ += 1;
54
+ menu.addItem(titleComponent);
55
+ }
56
+ _this.items = _this.createItems();
57
+ if (_this.items) {
58
+ // Add menu items to the menu
59
+ for (var i = 0; i < _this.items.length; i++) {
60
+ menu.addItem(_this.items[i]);
61
+ }
82
62
  }
63
+ return menu;
83
64
  }
84
- return menu;
85
- };
86
- return ConcreteButton;
87
- }(MenuButton);
65
+ });
66
+ return ConcreteButtonInit;
67
+ }
88
68
 
89
- // Concrete classes
90
69
  var VideoJsMenuItemClass = videojs.getComponent('MenuItem');
91
-
92
70
  /**
93
- * Extend vjs menu item class.
71
+ * Create a QualitySelectorHls plugin instance.
72
+ *
73
+ * @param {player} player
74
+ * A Video.js Player instance.
75
+ *
76
+ * @param {item} [item]
77
+ * The Item Quality Item
78
+ *
79
+ * @param {qualityButton} [qualityButton]
80
+ * ConcreteButton
81
+ *
82
+ * @param {plugin} plugin
83
+ * Plugin
84
+ *
85
+ * @return {MenuItem} MenuItem
86
+ * VideoJS Menu Item Class
94
87
  */
95
- var ConcreteMenuItem = /*#__PURE__*/function (_VideoJsMenuItemClass) {
96
- _inheritsLoose(ConcreteMenuItem, _VideoJsMenuItemClass);
97
- /**
98
- * Menu item constructor.
99
- *
100
- * @param {Player} player - vjs player
101
- * @param {Object} item - Item object
102
- * @param {ConcreteButton} qualityButton - The containing button.
103
- * @param {HlsQualitySelector} plugin - This plugin instance.
104
- */
105
- function ConcreteMenuItem(player, item, qualityButton, plugin) {
106
- var _this;
107
- _this = _VideoJsMenuItemClass.call(this, player, {
108
- label: item.label,
109
- selectable: true,
110
- selected: item.selected || false
111
- }) || this;
112
- _this.item = item;
113
- _this.qualityButton = qualityButton;
114
- _this.plugin = plugin;
115
- return _this;
116
- }
117
88
 
118
- /**
119
- * Click event for menu item.
120
- */
121
- var _proto = ConcreteMenuItem.prototype;
122
- _proto.handleClick = function handleClick() {
89
+ function ConcreteMenuItem(player, item, qualityButton, plugin) {
90
+ var ConcreteMenuItemInit = new VideoJsMenuItemClass(player, {
91
+ label: item.label,
92
+ selectable: true,
93
+ selected: item.selected || false
94
+ });
95
+ ConcreteMenuItemInit.item = item;
96
+ ConcreteMenuItemInit.qualityButton = qualityButton;
97
+ ConcreteMenuItemInit.plugin = plugin;
98
+ ConcreteMenuItemInit.handleClick = function () {
123
99
  // Reset other menu items selected status.
124
100
  for (var i = 0; i < this.qualityButton.items.length; ++i) {
125
101
  this.qualityButton.items[i].selected(false);
126
- }
102
+ } // Set this menu item to selected, and set quality.
127
103
 
128
- // Set this menu item to selected, and set quality.
129
104
  this.plugin.setQuality(this.item.value);
130
105
  this.selected(true);
131
106
  };
132
- return ConcreteMenuItem;
133
- }(VideoJsMenuItemClass);
134
-
135
- var Plugin = videojs.getPlugin('plugin');
107
+ return ConcreteMenuItemInit;
108
+ }
136
109
 
137
110
  // Default options for the plugin.
138
- var defaults = {};
139
111
 
112
+ var defaults = {
113
+ vjsIconClass: 'vjs-icon-hd',
114
+ displayCurrentQuality: false,
115
+ placementIndex: 0
116
+ };
140
117
  /**
141
118
  * An advanced Video.js plugin. For more information on the API
142
119
  *
143
120
  * See: https://blog.videojs.com/feature-spotlight-advanced-plugins/
144
121
  */
145
- var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
146
- _inheritsLoose(HlsQualitySelector, _Plugin);
122
+
123
+ var QualitySelectorHlsClass = /*#__PURE__*/function () {
147
124
  /**
148
- * Create a HlsQualitySelector plugin instance.
125
+ * Create a QualitySelectorHls plugin instance.
149
126
  *
150
127
  * @param {Player} player
151
128
  * A Video.js Player instance.
@@ -157,31 +134,39 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
157
134
  * second argument of options is a convenient way to accept inputs
158
135
  * from your plugin's caller.
159
136
  */
160
- function HlsQualitySelector(player, options) {
161
- var _this;
137
+ function QualitySelectorHlsClass(player, options) {
138
+ var _this = this;
139
+
162
140
  // the parent class will add player under this.player
163
- _this = _Plugin.call(this, player) || this;
164
- _this.options = videojs.obj.merge(defaults, options);
165
- _this.player.ready(function () {
166
- // If there is quality levels plugin and the HLS tech exists then continue.
141
+ this.player = player;
142
+ this.config = videojs.obj.merge(defaults, options);
143
+ player.ready(function () {
144
+ _this.player.addClass('vjs-quality-selector-hls');
167
145
  if (_this.player.qualityLevels) {
168
- _this.player.addClass('vjs-hls-quality-selector');
169
146
  // Create the quality button.
170
147
  _this.createQualityButton();
171
148
  _this.bindPlayerEvents();
172
149
  }
173
150
  });
174
- return _this;
175
151
  }
152
+ /**
153
+ * Returns HLS Plugin
154
+ *
155
+ * @return {*} - videojs-hls-contrib plugin.
156
+ */
176
157
 
158
+ var _proto = QualitySelectorHlsClass.prototype;
159
+ _proto.getHls = function getHls() {
160
+ return this.player.tech({
161
+ IWillNotUseThisInPlugins: true
162
+ }).hls;
163
+ }
177
164
  /**
178
165
  * Binds listener for quality level changes.
179
- */
180
- var _proto = HlsQualitySelector.prototype;
166
+ */;
181
167
  _proto.bindPlayerEvents = function bindPlayerEvents() {
182
168
  this.player.qualityLevels().on('addqualitylevel', this.onAddQualityLevel.bind(this));
183
169
  }
184
-
185
170
  /**
186
171
  * Adds the quality menu button to the player control bar.
187
172
  */;
@@ -191,26 +176,24 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
191
176
  var placementIndex = player.controlBar.children().length - 2;
192
177
  var concreteButtonInstance = player.controlBar.addChild(this._qualityButton, {
193
178
  componentClass: 'qualitySelector'
194
- }, this.options.placementIndex || placementIndex);
179
+ }, this.config.placementIndex || placementIndex);
195
180
  concreteButtonInstance.addClass('vjs-quality-selector');
196
- if (!this.options.displayCurrentQuality) {
197
- var icon = " " + (this.options.vjsIconClass || 'vjs-icon-hd');
181
+ if (!this.config.displayCurrentQuality) {
182
+ var icon = " " + (this.config.vjsIconClass || 'vjs-icon-hd');
198
183
  concreteButtonInstance.menuButton_.$('.vjs-icon-placeholder').className += icon;
199
184
  } else {
200
- this.setButtonInnerText(player.localize('Auto'));
185
+ this.setButtonInnerText('auto');
201
186
  }
202
187
  concreteButtonInstance.removeClass('vjs-hidden');
203
188
  }
204
-
205
189
  /**
206
- *Set inner button text.
207
- *
208
- * @param {string} text - the text to display in the button.
209
- */;
190
+ *Set inner button text.
191
+ *
192
+ * @param {string} text - the text to display in the button.
193
+ */;
210
194
  _proto.setButtonInnerText = function setButtonInnerText(text) {
211
195
  this._qualityButton.menuButton_.$('.vjs-icon-placeholder').innerHTML = text;
212
196
  }
213
-
214
197
  /**
215
198
  * Builds individual quality menu items.
216
199
  *
@@ -219,9 +202,8 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
219
202
  */;
220
203
  _proto.getQualityMenuItem = function getQualityMenuItem(item) {
221
204
  var player = this.player;
222
- return new ConcreteMenuItem(player, item, this._qualityButton, this);
205
+ return ConcreteMenuItem(player, item, this._qualityButton, this);
223
206
  }
224
-
225
207
  /**
226
208
  * Executed when a quality level is added from HLS playlist.
227
209
  */;
@@ -231,13 +213,13 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
231
213
  var qualityList = player.qualityLevels();
232
214
  var levels = qualityList.levels_ || [];
233
215
  var levelItems = [];
234
- var _loop = function _loop() {
216
+ var _loop = function _loop(i) {
235
217
  var _levels$i = levels[i],
236
218
  width = _levels$i.width,
237
219
  height = _levels$i.height;
238
220
  var pixels = width > height ? height : width;
239
221
  if (!pixels) {
240
- return 1; // continue
222
+ return "continue";
241
223
  }
242
224
  if (!levelItems.filter(function (_existingItem) {
243
225
  return _existingItem.item && _existingItem.item.value === pixels;
@@ -250,7 +232,8 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
250
232
  }
251
233
  };
252
234
  for (var i = 0; i < levels.length; ++i) {
253
- if (_loop()) continue;
235
+ var _ret = _loop(i);
236
+ if (_ret === "continue") continue;
254
237
  }
255
238
  levelItems.sort(function (current, next) {
256
239
  if (typeof current !== 'object' || typeof next !== 'object') {
@@ -265,7 +248,7 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
265
248
  return 0;
266
249
  });
267
250
  levelItems.push(this.getQualityMenuItem.call(this, {
268
- label: this.player.localize('Auto'),
251
+ label: player.localize('Auto'),
269
252
  value: 'auto',
270
253
  selected: true
271
254
  }));
@@ -276,19 +259,17 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
276
259
  this._qualityButton.update();
277
260
  }
278
261
  }
279
-
280
262
  /**
281
263
  * Sets quality (based on media short side)
282
264
  *
283
265
  * @param {number} quality - A number representing HLS playlist.
284
266
  */;
285
267
  _proto.setQuality = function setQuality(quality) {
286
- var qualityList = this.player.qualityLevels();
268
+ var qualityList = this.player.qualityLevels(); // Set quality on plugin
287
269
 
288
- // Set quality on plugin
289
270
  this._currentQuality = quality;
290
- if (this.options.displayCurrentQuality) {
291
- this.setButtonInnerText(quality === 'auto' ? this.player.localize('Auto') : quality + "p");
271
+ if (this.config.displayCurrentQuality) {
272
+ this.setButtonInnerText(quality === 'auto' ? quality : quality + "p");
292
273
  }
293
274
  for (var i = 0; i < qualityList.length; ++i) {
294
275
  var _qualityList$i = qualityList[i],
@@ -299,7 +280,6 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
299
280
  }
300
281
  this._qualityButton.unpressButton();
301
282
  }
302
-
303
283
  /**
304
284
  * Return the current set quality or 'auto'
305
285
  *
@@ -308,11 +288,21 @@ var HlsQualitySelector = /*#__PURE__*/function (_Plugin) {
308
288
  _proto.getCurrentQuality = function getCurrentQuality() {
309
289
  return this._currentQuality || 'auto';
310
290
  };
311
- return HlsQualitySelector;
312
- }(Plugin); // Include the version number.
313
- HlsQualitySelector.VERSION = version;
291
+ return QualitySelectorHlsClass;
292
+ }();
293
+ var initPlugin = function initPlugin(player, options) {
294
+ var QualitySelectorHls = new QualitySelectorHlsClass(player, options);
295
+ player.QualitySelectorHlsVjs = true; // Define default values for the plugin's `state` object here.
296
+
297
+ QualitySelectorHls.defaultState = {}; // Include the version number.
298
+
299
+ QualitySelectorHls.VERSION = version;
300
+ return QualitySelectorHls;
301
+ };
302
+ var QualitySelectorHls = function QualitySelectorHls(options) {
303
+ return initPlugin(this, videojs.obj.merge({}, options));
304
+ }; // Register the plugin with video.js.
314
305
 
315
- // Register the plugin with video.js.
316
- videojs.registerPlugin('hlsQualitySelector', HlsQualitySelector);
306
+ videojs.registerPlugin('qualitySelectorHls', QualitySelectorHls);
317
307
 
318
- export { HlsQualitySelector as default };
308
+ export { QualitySelectorHls as default };