@antmedia/web_player 2.8.0-SNAPSHOT

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/.project +17 -0
  2. package/.settings/.jsdtscope +7 -0
  3. package/.settings/org.eclipse.wst.jsdt.ui.superType.container +1 -0
  4. package/.settings/org.eclipse.wst.jsdt.ui.superType.name +1 -0
  5. package/LICENSE +201 -0
  6. package/README.md +1 -0
  7. package/api-extractor.json +38 -0
  8. package/codecov.yml +6 -0
  9. package/dist/_commonjsHelpers-ed042b00.js +10 -0
  10. package/dist/aframe-master-42bb78a9.js +7139 -0
  11. package/dist/browser/web_player.js +976 -0
  12. package/dist/dash.all.min-84806d51.js +36 -0
  13. package/dist/es/_commonjsHelpers-7d1333e8.js +7 -0
  14. package/dist/es/aframe-master-a6146619.js +7137 -0
  15. package/dist/es/dash.all.min-4a2772b6.js +34 -0
  16. package/dist/es/index.d.ts +227 -0
  17. package/dist/es/index.js +1 -0
  18. package/dist/es/video-js.min-8b4dfe88.js +3 -0
  19. package/dist/es/video.es-22056625.js +31061 -0
  20. package/dist/es/videojs-contrib-quality-levels.es-5f5b5f23.js +287 -0
  21. package/dist/es/videojs-hls-quality-selector.es-3c54e1cd.js +391 -0
  22. package/dist/es/videojs-webrtc-plugin-b9e4da27.js +3 -0
  23. package/dist/es/videojs-webrtc-plugin.es-f41400f7.js +7649 -0
  24. package/dist/es/web_player.js +1262 -0
  25. package/dist/index.d.ts +227 -0
  26. package/dist/index.js +7 -0
  27. package/dist/video-js.min-7e4ae47a.js +5 -0
  28. package/dist/video.es-72122d04.js +31067 -0
  29. package/dist/videojs-contrib-quality-levels.es-ef3cec9e.js +289 -0
  30. package/dist/videojs-hls-quality-selector.es-562309df.js +393 -0
  31. package/dist/videojs-webrtc-plugin-d30c3e7a.js +5 -0
  32. package/dist/videojs-webrtc-plugin.es-ac81d249.js +7651 -0
  33. package/dist/web_player.js +1265 -0
  34. package/karma.conf.cjs +74 -0
  35. package/package.json +68 -0
  36. package/rollup.config.browser.cjs +16 -0
  37. package/rollup.config.module.cjs +42 -0
  38. package/src/index.js +1 -0
  39. package/src/web_player.js +1133 -0
  40. package/test/embedded-player.test.js +864 -0
  41. package/tsconfig.json +24 -0
@@ -0,0 +1,287 @@
1
+ import { v as videojs } from './video.es-22056625.js';
2
+ import './_commonjsHelpers-7d1333e8.js';
3
+
4
+ /*! @name videojs-contrib-quality-levels @version 2.2.1 @license Apache-2.0 */
5
+ function _inheritsLoose(subClass, superClass) {
6
+ subClass.prototype = Object.create(superClass.prototype);
7
+ subClass.prototype.constructor = subClass;
8
+ subClass.__proto__ = superClass;
9
+ }
10
+ function _assertThisInitialized(self) {
11
+ if (self === void 0) {
12
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13
+ }
14
+ return self;
15
+ }
16
+
17
+ /**
18
+ * A single QualityLevel.
19
+ *
20
+ * interface QualityLevel {
21
+ * readonly attribute DOMString id;
22
+ * attribute DOMString label;
23
+ * readonly attribute long width;
24
+ * readonly attribute long height;
25
+ * readonly attribute long bitrate;
26
+ * attribute boolean enabled;
27
+ * };
28
+ *
29
+ * @class QualityLevel
30
+ */
31
+ var QualityLevel =
32
+ /**
33
+ * Creates a QualityLevel
34
+ *
35
+ * @param {Representation|Object} representation The representation of the quality level
36
+ * @param {string} representation.id Unique id of the QualityLevel
37
+ * @param {number=} representation.width Resolution width of the QualityLevel
38
+ * @param {number=} representation.height Resolution height of the QualityLevel
39
+ * @param {number} representation.bandwidth Bitrate of the QualityLevel
40
+ * @param {number=} representation.frameRate Frame-rate of the QualityLevel
41
+ * @param {Function} representation.enabled Callback to enable/disable QualityLevel
42
+ */
43
+ function QualityLevel(representation) {
44
+ var level = this; // eslint-disable-line
45
+
46
+ level.id = representation.id;
47
+ level.label = level.id;
48
+ level.width = representation.width;
49
+ level.height = representation.height;
50
+ level.bitrate = representation.bandwidth;
51
+ level.frameRate = representation.frameRate;
52
+ level.enabled_ = representation.enabled;
53
+ Object.defineProperty(level, 'enabled', {
54
+ /**
55
+ * Get whether the QualityLevel is enabled.
56
+ *
57
+ * @return {boolean} True if the QualityLevel is enabled.
58
+ */
59
+ get: function get() {
60
+ return level.enabled_();
61
+ },
62
+ /**
63
+ * Enable or disable the QualityLevel.
64
+ *
65
+ * @param {boolean} enable true to enable QualityLevel, false to disable.
66
+ */
67
+ set: function set(enable) {
68
+ level.enabled_(enable);
69
+ }
70
+ });
71
+ return level;
72
+ };
73
+
74
+ /**
75
+ * A list of QualityLevels.
76
+ *
77
+ * interface QualityLevelList : EventTarget {
78
+ * getter QualityLevel (unsigned long index);
79
+ * readonly attribute unsigned long length;
80
+ * readonly attribute long selectedIndex;
81
+ *
82
+ * void addQualityLevel(QualityLevel qualityLevel)
83
+ * void removeQualityLevel(QualityLevel remove)
84
+ * QualityLevel? getQualityLevelById(DOMString id);
85
+ *
86
+ * attribute EventHandler onchange;
87
+ * attribute EventHandler onaddqualitylevel;
88
+ * attribute EventHandler onremovequalitylevel;
89
+ * };
90
+ *
91
+ * @extends videojs.EventTarget
92
+ * @class QualityLevelList
93
+ */
94
+
95
+ var QualityLevelList = /*#__PURE__*/
96
+ function (_videojs$EventTarget) {
97
+ _inheritsLoose(QualityLevelList, _videojs$EventTarget);
98
+ function QualityLevelList() {
99
+ var _this;
100
+ _this = _videojs$EventTarget.call(this) || this;
101
+ var list = _assertThisInitialized(_assertThisInitialized(_this)); // eslint-disable-line
102
+
103
+ list.levels_ = [];
104
+ list.selectedIndex_ = -1;
105
+ /**
106
+ * Get the index of the currently selected QualityLevel.
107
+ *
108
+ * @returns {number} The index of the selected QualityLevel. -1 if none selected.
109
+ * @readonly
110
+ */
111
+
112
+ Object.defineProperty(list, 'selectedIndex', {
113
+ get: function get() {
114
+ return list.selectedIndex_;
115
+ }
116
+ });
117
+ /**
118
+ * Get the length of the list of QualityLevels.
119
+ *
120
+ * @returns {number} The length of the list.
121
+ * @readonly
122
+ */
123
+
124
+ Object.defineProperty(list, 'length', {
125
+ get: function get() {
126
+ return list.levels_.length;
127
+ }
128
+ });
129
+ return list || _assertThisInitialized(_this);
130
+ }
131
+ /**
132
+ * Adds a quality level to the list.
133
+ *
134
+ * @param {Representation|Object} representation The representation of the quality level
135
+ * @param {string} representation.id Unique id of the QualityLevel
136
+ * @param {number=} representation.width Resolution width of the QualityLevel
137
+ * @param {number=} representation.height Resolution height of the QualityLevel
138
+ * @param {number} representation.bandwidth Bitrate of the QualityLevel
139
+ * @param {number=} representation.frameRate Frame-rate of the QualityLevel
140
+ * @param {Function} representation.enabled Callback to enable/disable QualityLevel
141
+ * @return {QualityLevel} the QualityLevel added to the list
142
+ * @method addQualityLevel
143
+ */
144
+
145
+ var _proto = QualityLevelList.prototype;
146
+ _proto.addQualityLevel = function addQualityLevel(representation) {
147
+ var qualityLevel = this.getQualityLevelById(representation.id); // Do not add duplicate quality levels
148
+
149
+ if (qualityLevel) {
150
+ return qualityLevel;
151
+ }
152
+ var index = this.levels_.length;
153
+ qualityLevel = new QualityLevel(representation);
154
+ if (!('' + index in this)) {
155
+ Object.defineProperty(this, index, {
156
+ get: function get() {
157
+ return this.levels_[index];
158
+ }
159
+ });
160
+ }
161
+ this.levels_.push(qualityLevel);
162
+ this.trigger({
163
+ qualityLevel: qualityLevel,
164
+ type: 'addqualitylevel'
165
+ });
166
+ return qualityLevel;
167
+ };
168
+ /**
169
+ * Removes a quality level from the list.
170
+ *
171
+ * @param {QualityLevel} remove QualityLevel to remove to the list.
172
+ * @return {QualityLevel|null} the QualityLevel removed or null if nothing removed
173
+ * @method removeQualityLevel
174
+ */
175
+
176
+ _proto.removeQualityLevel = function removeQualityLevel(qualityLevel) {
177
+ var removed = null;
178
+ for (var i = 0, l = this.length; i < l; i++) {
179
+ if (this[i] === qualityLevel) {
180
+ removed = this.levels_.splice(i, 1)[0];
181
+ if (this.selectedIndex_ === i) {
182
+ this.selectedIndex_ = -1;
183
+ } else if (this.selectedIndex_ > i) {
184
+ this.selectedIndex_--;
185
+ }
186
+ break;
187
+ }
188
+ }
189
+ if (removed) {
190
+ this.trigger({
191
+ qualityLevel: qualityLevel,
192
+ type: 'removequalitylevel'
193
+ });
194
+ }
195
+ return removed;
196
+ };
197
+ /**
198
+ * Searches for a QualityLevel with the given id.
199
+ *
200
+ * @param {string} id The id of the QualityLevel to find.
201
+ * @return {QualityLevel|null} The QualityLevel with id, or null if not found.
202
+ * @method getQualityLevelById
203
+ */
204
+
205
+ _proto.getQualityLevelById = function getQualityLevelById(id) {
206
+ for (var i = 0, l = this.length; i < l; i++) {
207
+ var level = this[i];
208
+ if (level.id === id) {
209
+ return level;
210
+ }
211
+ }
212
+ return null;
213
+ };
214
+ /**
215
+ * Resets the list of QualityLevels to empty
216
+ *
217
+ * @method dispose
218
+ */
219
+
220
+ _proto.dispose = function dispose() {
221
+ this.selectedIndex_ = -1;
222
+ this.levels_.length = 0;
223
+ };
224
+ return QualityLevelList;
225
+ }(videojs.EventTarget);
226
+ /**
227
+ * change - The selected QualityLevel has changed.
228
+ * addqualitylevel - A QualityLevel has been added to the QualityLevelList.
229
+ * removequalitylevel - A QualityLevel has been removed from the QualityLevelList.
230
+ */
231
+
232
+ QualityLevelList.prototype.allowedEvents_ = {
233
+ change: 'change',
234
+ addqualitylevel: 'addqualitylevel',
235
+ removequalitylevel: 'removequalitylevel'
236
+ }; // emulate attribute EventHandler support to allow for feature detection
237
+
238
+ for (var event in QualityLevelList.prototype.allowedEvents_) {
239
+ QualityLevelList.prototype['on' + event] = null;
240
+ }
241
+ var version = "2.2.1";
242
+ var registerPlugin = videojs.registerPlugin || videojs.plugin;
243
+ /**
244
+ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and
245
+ * event handlers.
246
+ *
247
+ * @param {Player} player Player object.
248
+ * @param {Object} options Plugin options object.
249
+ * @function initPlugin
250
+ */
251
+
252
+ var initPlugin = function initPlugin(player, options) {
253
+ var originalPluginFn = player.qualityLevels;
254
+ var qualityLevelList = new QualityLevelList();
255
+ var disposeHandler = function disposeHandler() {
256
+ qualityLevelList.dispose();
257
+ player.qualityLevels = originalPluginFn;
258
+ player.off('dispose', disposeHandler);
259
+ };
260
+ player.on('dispose', disposeHandler);
261
+ player.qualityLevels = function () {
262
+ return qualityLevelList;
263
+ };
264
+ player.qualityLevels.VERSION = version;
265
+ return qualityLevelList;
266
+ };
267
+ /**
268
+ * A video.js plugin.
269
+ *
270
+ * In the plugin function, the value of `this` is a video.js `Player`
271
+ * instance. You cannot rely on the player being in a "ready" state here,
272
+ * depending on how the plugin is invoked. This may or may not be important
273
+ * to you; if not, remove the wait for "ready"!
274
+ *
275
+ * @param {Object} options Plugin options object
276
+ * @function qualityLevels
277
+ */
278
+
279
+ var qualityLevels = function qualityLevels(options) {
280
+ return initPlugin(this, videojs.mergeOptions({}, options));
281
+ }; // Register the plugin with video.js.
282
+
283
+ registerPlugin('qualityLevels', qualityLevels); // Include the version number.
284
+
285
+ qualityLevels.VERSION = version;
286
+
287
+ export { qualityLevels as default };
@@ -0,0 +1,391 @@
1
+ import { v as videojs } from './video.es-22056625.js';
2
+ import './_commonjsHelpers-7d1333e8.js';
3
+
4
+ var version = "1.1.4";
5
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
6
+ return typeof obj;
7
+ } : function (obj) {
8
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
9
+ };
10
+ var classCallCheck = function (instance, Constructor) {
11
+ if (!(instance instanceof Constructor)) {
12
+ throw new TypeError("Cannot call a class as a function");
13
+ }
14
+ };
15
+ var inherits = function (subClass, superClass) {
16
+ if (typeof superClass !== "function" && superClass !== null) {
17
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
18
+ }
19
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
20
+ constructor: {
21
+ value: subClass,
22
+ enumerable: false,
23
+ writable: true,
24
+ configurable: true
25
+ }
26
+ });
27
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
28
+ };
29
+ var possibleConstructorReturn = function (self, call) {
30
+ if (!self) {
31
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
32
+ }
33
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
34
+ };
35
+ var VideoJsButtonClass = videojs.getComponent('MenuButton');
36
+ var VideoJsMenuClass = videojs.getComponent('Menu');
37
+ var VideoJsComponent = videojs.getComponent('Component');
38
+ var Dom = videojs.dom;
39
+
40
+ /**
41
+ * Convert string to title case.
42
+ *
43
+ * @param {string} string - the string to convert
44
+ * @return {string} the returned titlecase string
45
+ */
46
+ function toTitleCase(string) {
47
+ if (typeof string !== 'string') {
48
+ return string;
49
+ }
50
+ return string.charAt(0).toUpperCase() + string.slice(1);
51
+ }
52
+
53
+ /**
54
+ * Extend vjs button class for quality button.
55
+ */
56
+
57
+ var ConcreteButton = function (_VideoJsButtonClass) {
58
+ inherits(ConcreteButton, _VideoJsButtonClass);
59
+
60
+ /**
61
+ * Button constructor.
62
+ *
63
+ * @param {Player} player - videojs player instance
64
+ */
65
+ function ConcreteButton(player) {
66
+ classCallCheck(this, ConcreteButton);
67
+ return possibleConstructorReturn(this, _VideoJsButtonClass.call(this, player, {
68
+ title: player.localize('Quality'),
69
+ name: 'QualityButton'
70
+ }));
71
+ }
72
+
73
+ /**
74
+ * Creates button items.
75
+ *
76
+ * @return {Array} - Button items
77
+ */
78
+
79
+ ConcreteButton.prototype.createItems = function createItems() {
80
+ return [];
81
+ };
82
+
83
+ /**
84
+ * Create the menu and add all items to it.
85
+ *
86
+ * @return {Menu}
87
+ * The constructed menu
88
+ */
89
+
90
+ ConcreteButton.prototype.createMenu = function createMenu() {
91
+ var menu = new VideoJsMenuClass(this.player_, {
92
+ menuButton: this
93
+ });
94
+ this.hideThreshold_ = 0;
95
+
96
+ // Add a title list item to the top
97
+ if (this.options_.title) {
98
+ var titleEl = Dom.createEl('li', {
99
+ className: 'vjs-menu-title',
100
+ innerHTML: toTitleCase(this.options_.title),
101
+ tabIndex: -1
102
+ });
103
+ var titleComponent = new VideoJsComponent(this.player_, {
104
+ el: titleEl
105
+ });
106
+ this.hideThreshold_ += 1;
107
+ menu.addItem(titleComponent);
108
+ }
109
+ this.items = this.createItems();
110
+ if (this.items) {
111
+ // Add menu items to the menu
112
+ for (var i = 0; i < this.items.length; i++) {
113
+ menu.addItem(this.items[i]);
114
+ }
115
+ }
116
+ return menu;
117
+ };
118
+ return ConcreteButton;
119
+ }(VideoJsButtonClass);
120
+
121
+ // Concrete classes
122
+ var VideoJsMenuItemClass = videojs.getComponent('MenuItem');
123
+
124
+ /**
125
+ * Extend vjs menu item class.
126
+ */
127
+
128
+ var ConcreteMenuItem = function (_VideoJsMenuItemClass) {
129
+ inherits(ConcreteMenuItem, _VideoJsMenuItemClass);
130
+
131
+ /**
132
+ * Menu item constructor.
133
+ *
134
+ * @param {Player} player - vjs player
135
+ * @param {Object} item - Item object
136
+ * @param {ConcreteButton} qualityButton - The containing button.
137
+ * @param {HlsQualitySelectorPlugin} plugin - This plugin instance.
138
+ */
139
+ function ConcreteMenuItem(player, item, qualityButton, plugin) {
140
+ classCallCheck(this, ConcreteMenuItem);
141
+ var _this = possibleConstructorReturn(this, _VideoJsMenuItemClass.call(this, player, {
142
+ label: item.label,
143
+ selectable: true,
144
+ selected: item.selected || false
145
+ }));
146
+ _this.item = item;
147
+ _this.qualityButton = qualityButton;
148
+ _this.plugin = plugin;
149
+ return _this;
150
+ }
151
+
152
+ /**
153
+ * Click event for menu item.
154
+ */
155
+
156
+ ConcreteMenuItem.prototype.handleClick = function handleClick() {
157
+ // Reset other menu items selected status.
158
+ for (var i = 0; i < this.qualityButton.items.length; ++i) {
159
+ this.qualityButton.items[i].selected(false);
160
+ }
161
+
162
+ // Set this menu item to selected, and set quality.
163
+ this.plugin.setQuality(this.item.value);
164
+ this.selected(true);
165
+ };
166
+ return ConcreteMenuItem;
167
+ }(VideoJsMenuItemClass);
168
+
169
+ // Default options for the plugin.
170
+ var defaults = {};
171
+
172
+ // Cross-compatibility for Video.js 5 and 6.
173
+ var registerPlugin = videojs.registerPlugin || videojs.plugin;
174
+ // const dom = videojs.dom || videojs;
175
+
176
+ /**
177
+ * VideoJS HLS Quality Selector Plugin class.
178
+ */
179
+
180
+ var HlsQualitySelectorPlugin = function () {
181
+ /**
182
+ * Plugin Constructor.
183
+ *
184
+ * @param {Player} player - The videojs player instance.
185
+ * @param {Object} options - The plugin options.
186
+ */
187
+ function HlsQualitySelectorPlugin(player, options) {
188
+ classCallCheck(this, HlsQualitySelectorPlugin);
189
+ this.player = player;
190
+ this.config = options;
191
+
192
+ // If there is quality levels plugin and the HLS tech exists
193
+ // then continue.
194
+ if (this.player.qualityLevels && this.getHls()) {
195
+ // Create the quality button.
196
+ this.createQualityButton();
197
+ this.bindPlayerEvents();
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Returns HLS Plugin
203
+ *
204
+ * @return {*} - videojs-hls-contrib plugin.
205
+ */
206
+
207
+ HlsQualitySelectorPlugin.prototype.getHls = function getHls() {
208
+ return this.player.tech({
209
+ IWillNotUseThisInPlugins: true
210
+ }).hls;
211
+ };
212
+
213
+ /**
214
+ * Binds listener for quality level changes.
215
+ */
216
+
217
+ HlsQualitySelectorPlugin.prototype.bindPlayerEvents = function bindPlayerEvents() {
218
+ this.player.qualityLevels().on('addqualitylevel', this.onAddQualityLevel.bind(this));
219
+ };
220
+
221
+ /**
222
+ * Adds the quality menu button to the player control bar.
223
+ */
224
+
225
+ HlsQualitySelectorPlugin.prototype.createQualityButton = function createQualityButton() {
226
+ var player = this.player;
227
+ this._qualityButton = new ConcreteButton(player);
228
+ var placementIndex = player.controlBar.children().length - 2;
229
+ var concreteButtonInstance = player.controlBar.addChild(this._qualityButton, {
230
+ componentClass: 'qualitySelector'
231
+ }, this.config.placementIndex || placementIndex);
232
+ concreteButtonInstance.addClass('vjs-quality-selector');
233
+ if (!this.config.displayCurrentQuality) {
234
+ var icon = ' ' + (this.config.vjsIconClass || 'vjs-icon-hd');
235
+ concreteButtonInstance.menuButton_.$('.vjs-icon-placeholder').className += icon;
236
+ } else {
237
+ this.setButtonInnerText('auto');
238
+ }
239
+ concreteButtonInstance.removeClass('vjs-hidden');
240
+ };
241
+
242
+ /**
243
+ *Set inner button text.
244
+ *
245
+ * @param {string} text - the text to display in the button.
246
+ */
247
+
248
+ HlsQualitySelectorPlugin.prototype.setButtonInnerText = function setButtonInnerText(text) {
249
+ this._qualityButton.menuButton_.$('.vjs-icon-placeholder').innerHTML = text;
250
+ };
251
+
252
+ /**
253
+ * Builds individual quality menu items.
254
+ *
255
+ * @param {Object} item - Individual quality menu item.
256
+ * @return {ConcreteMenuItem} - Menu item
257
+ */
258
+
259
+ HlsQualitySelectorPlugin.prototype.getQualityMenuItem = function getQualityMenuItem(item) {
260
+ var player = this.player;
261
+ return new ConcreteMenuItem(player, item, this._qualityButton, this);
262
+ };
263
+
264
+ /**
265
+ * Executed when a quality level is added from HLS playlist.
266
+ */
267
+
268
+ HlsQualitySelectorPlugin.prototype.onAddQualityLevel = function onAddQualityLevel() {
269
+ var _this = this;
270
+ var player = this.player;
271
+ var qualityList = player.qualityLevels();
272
+ var levels = qualityList.levels_ || [];
273
+ var levelItems = [];
274
+ var _loop = function _loop(i) {
275
+ if (!levelItems.filter(function (_existingItem) {
276
+ return _existingItem.item && _existingItem.item.value === levels[i].height;
277
+ }).length) {
278
+ var levelItem = _this.getQualityMenuItem.call(_this, {
279
+ label: levels[i].height + 'p',
280
+ value: levels[i].height
281
+ });
282
+ levelItems.push(levelItem);
283
+ }
284
+ };
285
+ for (var i = 0; i < levels.length; ++i) {
286
+ _loop(i);
287
+ }
288
+ levelItems.sort(function (current, next) {
289
+ if ((typeof current === 'undefined' ? 'undefined' : _typeof(current)) !== 'object' || (typeof next === 'undefined' ? 'undefined' : _typeof(next)) !== 'object') {
290
+ return -1;
291
+ }
292
+ if (current.item.value < next.item.value) {
293
+ return -1;
294
+ }
295
+ if (current.item.value > next.item.value) {
296
+ return 1;
297
+ }
298
+ return 0;
299
+ });
300
+ levelItems.push(this.getQualityMenuItem.call(this, {
301
+ label: player.localize('Auto'),
302
+ value: 'auto',
303
+ selected: true
304
+ }));
305
+ if (this._qualityButton) {
306
+ this._qualityButton.createItems = function () {
307
+ return levelItems;
308
+ };
309
+ this._qualityButton.update();
310
+ }
311
+ };
312
+
313
+ /**
314
+ * Sets quality (based on media height)
315
+ *
316
+ * @param {number} height - A number representing HLS playlist.
317
+ */
318
+
319
+ HlsQualitySelectorPlugin.prototype.setQuality = function setQuality(height) {
320
+ var qualityList = this.player.qualityLevels();
321
+
322
+ // Set quality on plugin
323
+ this._currentQuality = height;
324
+ if (this.config.displayCurrentQuality) {
325
+ this.setButtonInnerText(height === 'auto' ? height : height + 'p');
326
+ }
327
+ for (var i = 0; i < qualityList.length; ++i) {
328
+ var quality = qualityList[i];
329
+ quality.enabled = quality.height === height || height === 'auto';
330
+ }
331
+ this._qualityButton.unpressButton();
332
+ };
333
+
334
+ /**
335
+ * Return the current set quality or 'auto'
336
+ *
337
+ * @return {string} the currently set quality
338
+ */
339
+
340
+ HlsQualitySelectorPlugin.prototype.getCurrentQuality = function getCurrentQuality() {
341
+ return this._currentQuality || 'auto';
342
+ };
343
+ return HlsQualitySelectorPlugin;
344
+ }();
345
+
346
+ /**
347
+ * Function to invoke when the player is ready.
348
+ *
349
+ * This is a great place for your plugin to initialize itself. When this
350
+ * function is called, the player will have its DOM and child components
351
+ * in place.
352
+ *
353
+ * @function onPlayerReady
354
+ * @param {Player} player
355
+ * A Video.js player object.
356
+ *
357
+ * @param {Object} [options={}]
358
+ * A plain object containing options for the plugin.
359
+ */
360
+
361
+ var onPlayerReady = function onPlayerReady(player, options) {
362
+ player.addClass('vjs-hls-quality-selector');
363
+ player.hlsQualitySelector = new HlsQualitySelectorPlugin(player, options);
364
+ };
365
+
366
+ /**
367
+ * A video.js plugin.
368
+ *
369
+ * In the plugin function, the value of `this` is a video.js `Player`
370
+ * instance. You cannot rely on the player being in a "ready" state here,
371
+ * depending on how the plugin is invoked. This may or may not be important
372
+ * to you; if not, remove the wait for "ready"!
373
+ *
374
+ * @function hlsQualitySelector
375
+ * @param {Object} [options={}]
376
+ * An object of options left to the plugin author to define.
377
+ */
378
+ var hlsQualitySelector = function hlsQualitySelector(options) {
379
+ var _this2 = this;
380
+ this.ready(function () {
381
+ onPlayerReady(_this2, videojs.mergeOptions(defaults, options));
382
+ });
383
+ };
384
+
385
+ // Register the plugin with video.js.
386
+ registerPlugin('hlsQualitySelector', hlsQualitySelector);
387
+
388
+ // Include the version number.
389
+ hlsQualitySelector.VERSION = version;
390
+
391
+ export { hlsQualitySelector as default };
@@ -0,0 +1,3 @@
1
+ var videojsWebrtcPlugin = "/*! @name @antmedia/videojs-webrtc-plugin @version 1.2.1 @license MIT */\n.vjs-custom-spinner{position:absolute;top:50%;transform:translateY(-50%) translateX(-50%);left:50%;width:80px;height:80px}.vjs-custom-spinner:after{content:\" \";display:block;width:64px;height:64px;margin:8px;border-radius:50%;border:6px solid #fff;border-color:#fff transparent;-webkit-animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite;animation:vjs-spinner-spin 1.1s cubic-bezier(.6,.2,0,.8) infinite,vjs-spinner-fade 1.1s linear infinite}";
2
+
3
+ export { videojsWebrtcPlugin as default };